//
//  AddNewSignViewController.m
//  EMMApp
//
//  Created by Mac on 16/11/22.
//  Copyright © 2016年 YiXun. All rights reserved.
//

#import "AddNewSignViewController.h"
#import "NewCustomersCell.h"
#import "GetConsultantListApi.h"
#import "AddSignedApi.h"
#import "EditSignedApi.h"
#import "HousingViewController.h"
#import "NSString+Base64.h"
#import "NSData+Base64.h"
#import "QBImagePickerController.h"
#import "VGReturnPartPicViewCell.h"
#import "EMMImageView.h"
#import "MHPhotoBrowserController.h"
#import "GetSignedHaveAmountApi.h"
#import "GetRecommendCustomerListHanderApi.h"
#import "AddSubscriptionCell.h"
#import "GetDictionaryListApi.h"
#import "GetDictionaryListByProjectIdApi.h"
#import "EMMTouristsViewController.h"
#import "SignViewController.h"          //签约列表

@interface AddNewSignViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,QBImagePickerControllerDelegate,UIActionSheetDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,UIScrollViewDelegate,UITextViewDelegate> {

}

/**
 UITableView
 */
@property(nonatomic, strong) UITableView *tableView;

/**
 存对应的数据
 */
@property(nonatomic, strong) NSMutableDictionary *dictionary;

/**
 分区大数组
 */
@property(nonatomic, strong) NSMutableArray *titleDataArray;

/**
 二级列表是否展开状态
 */
@property(nonatomic, strong) NSMutableArray *selectedArr;

/**
 分区0数组个数
 */
@property(nonatomic, strong) NSMutableArray *grouparr0;

/**
 分区1数组个数
 */
@property(nonatomic, strong) NSMutableArray *grouparr1;

/**
 分区2数组个数
 */
@property(nonatomic, strong) NSMutableArray *grouparr2;
//分区1row = 0;
@property(nonatomic, assign) NSInteger fq2Cellrow0H;
//分区1row = 3;
@property(nonatomic, assign) NSInteger fq2Cellrow3H;
//分区1row = 7;
@property(nonatomic, assign) NSInteger fq2Cellrow7H;
/**
 分区3数组个数
 */
@property(nonatomic, strong) NSMutableArray *grouparr3;

@property (nonatomic, strong) NSMutableArray *fixGroups;

/**
 分区4数组个数
 */
@property(nonatomic, strong) NSMutableArray *grouparr4;


/**
 分区5数组个数
 */
@property(nonatomic, strong) NSMutableArray *grouparr5;
//分区1row = 0;
@property(nonatomic, assign) NSInteger fq5Cellrow0H;
//分区1row = 1;
@property(nonatomic, assign) NSInteger fq5Cellrow1H;

/**
 分区6数组个数
 */
@property(nonatomic, strong) NSMutableArray *grouparr6;

/**
 选择图片数组
 */
@property(nonatomic, strong) NSMutableArray* picArray;

/**
 选择图片数组
 */
@property(nonatomic, strong) NSMutableArray* picArray1;


/**
 选择图片数组
 */
@property(nonatomic, strong) NSMutableArray* picArraySele;

/**
 保存按钮
 */
@property (nonatomic, strong) UIButton *bcBtn;

/**
 提交按钮
 */
@property (nonatomic, strong) UIButton *tjBtn;

/**
 显示折扣比例与房源折扣比例对比
 */
@property (nonatomic, strong) UILabel *xianshibd;

/**
 签约编号输入框
 */
@property (nonatomic, strong) UITextField *signedCodeTextFile;

/**
 签约编号
 */
@property (nonatomic, strong) NSString *signedCode;

/**
 折后总价输入框
 */
@property (nonatomic, strong) UITextField *zhZjMoneyTextField;

/**
 折扣金额输入框
 */
@property (nonatomic, strong) UITextField *zkMoneyTextField;

/**
 折扣金额1
 */
@property (nonatomic, strong) NSString *discountAmount1;

/**
 折扣比例输入框
 */
@property (nonatomic, strong) UITextField *zkBLTextField;

/**
 优惠原因输入框
 */
@property (nonatomic, strong) UITextField *tsZKTextField;

/**
 优惠原因
 */
@property (nonatomic, strong) NSString *preferentialReasons;

/**
 折扣说明
 */
@property (nonatomic, strong) NSString *discountNote;

/**
 折扣说明输入框
 */
@property (nonatomic, strong) UITextField *discountNoteTextField;



/**
 付款方式ID
 */

@property (nonatomic, strong) NSString *paymentMethodId;

/**
 一次性付款 1
 */


/**
 应收金额
 */
@property (nonatomic, strong) UITextField *receivableTextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate;

/**
 已收
 */
@property (nonatomic, strong) NSString *yicxYSFKMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *yicxWSFKMony;

/**
 2分期付款
 */


/**
 应收金额输入框
 */
@property (nonatomic, strong) UITextField *receivable1TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable1;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate1;

/**
 已收
 */
@property (nonatomic, strong) NSString *fqYQYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *fqYQWSMony;

/**
 应收金额
 */
@property (nonatomic, strong) UITextField *receivable2TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable2;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate2;

/**
 已收
 */
@property (nonatomic, strong) NSString *fqEQYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *fqEQWSMony;

/**
 应收金额输入框
 */
@property (nonatomic, strong) UITextField *receivable3TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable3;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate3;

/**
 已收
 */
@property (nonatomic, strong) NSString *fqSQYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *fqSQWSMony;

/**
 应收金额输入框4
 */
@property (nonatomic, strong) UITextField *receivable4TextFile;

/**
 应收金额4
 */
@property (nonatomic, strong) NSString *receivable4;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate4;

/**
 已收
 */
@property (nonatomic, strong) NSString *fqSIQYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *fqSIQWSMony;

/**
 应收金额
 */
@property (nonatomic, strong) UITextField *receivable5TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable5;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate5;

/**
 已收
 */
@property (nonatomic, strong) NSString *fqWQYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *fqWQWSMony;

//3组合贷

/**
 应收金额
 */
@property (nonatomic, strong) UITextField *receivable6TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable6;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate6;

/**
 已收
 */
@property (nonatomic, strong) NSString *zhSFYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *zhSFWSMony;

/**
 应收金额
 */
@property (nonatomic, strong) UITextField *receivable7TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable7;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate7;

/**
 已收
 */
@property (nonatomic, strong) NSString *zhSYYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *zhSYWSMony;

/**
 应收金额
 */
@property (nonatomic, strong) UITextField *receivable8TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable8;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate8;

/**
 已收
 */
@property (nonatomic, strong) NSString *zhgjjYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *zhgjjWSMony;
//4商业

/**
 应收金额
 */
@property (nonatomic, strong) UITextField *receivable9TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable9;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate9;

/**
 已收
 */
@property (nonatomic, strong) NSString *sySFYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *sySFWSMony;

/**
 应收金额
 */
@property (nonatomic, strong) UITextField *receivable10TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable10;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate10;

/**
 已收
 */
@property (nonatomic, strong) NSString *syYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *syWSMony;
//5公积金

/**
 应收金额
 */
@property (nonatomic, strong) UITextField *receivable11TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable11;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate11;

/**
 已收
 */
@property (nonatomic, strong) NSString *gjjSFYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *gjjSFWSMony;

/**
 应收金额
 */
@property (nonatomic, strong) UITextField *receivable12TextFile;

/**
 应收金额
 */
@property (nonatomic, strong) NSString *receivable12;

/**
 应收日期
 */
@property (nonatomic, strong) NSString *receivableDate12;

/**
 已收
 */
@property (nonatomic, strong) NSString *gjjYSMony;

/**
 未收
 */
@property (nonatomic, strong) NSString *gjjWSMony;
////////////


/**
 推荐人名称输入框
 */
@property (nonatomic, strong) UITextField *referenceNameTextField;



/**
 推荐人分佣输入框
 */
@property (nonatomic, strong) UITextField *referenceProportionTextField;



/**
 认购日期
 */
@property (nonatomic, strong) NSString *signedDate;

/**
 备注输入框
 */
@property (nonatomic, strong) UITextView *remarkTV;

/**
 备注
 */
@property (nonatomic, strong) NSString *remark;
//备注框高度
@property (nonatomic, assign) CGFloat remarkTVHeight;

/**
 经纪人大数组
 */
@property (nonatomic, strong) NSMutableArray *zyData;

/**
 经纪人名称数组
 */
@property (nonatomic, strong) NSMutableArray *zyDataArr;

/**
 经纪人id数组
 */
@property (nonatomic, strong) NSMutableArray *zyDataArrId;

/**
 经纪人
 */
@property (nonatomic, strong) NSString *agentId;

/**
 经纪人
 */
@property (nonatomic, strong) NSString *agentName;

/**
 客户姓名
 */
@property (nonatomic, strong) NSString *memberName;
@property (nonatomic, strong) UITextField *memberNameTextField;

/**
 客户证件号输入框
 */
@property (nonatomic, strong) UITextField *khZJHTextField;

/**
 证件类型名称
 */
@property (nonatomic, strong) NSString *documentName;

/**
 证件类型Id
 */
@property (nonatomic, strong) NSString *documentType;

/**
 证件号码
 */
@property (nonatomic, strong) NSString *documentNumber;

/**
 客户预留号码输入框
 */
@property (nonatomic, strong) UITextField *khYLHTextField;

/**
 手机号码
 */
@property (nonatomic, strong) NSString *mobile;

/**
 客户邮寄地址输入框
 */
@property (nonatomic, strong) UITextView *mailPostTV;

/**
 邮寄地址
 */
@property (nonatomic, strong) NSString *mailPost;
// 邮寄地址输入框高度
@property (nonatomic, assign) CGFloat mailPostTVHeight;

/**
 客户邮编数据库
 */
@property (nonatomic, strong) UITextField *khYBTextField;

/**
 客户邮编
 */
@property (nonatomic, strong) NSString *postcode;

/**
 <#Description#>
 */
@property (nonatomic, strong) NSMutableArray *paymentMethodList;

/**
 <#Description#>
 */
@property (nonatomic, strong) NSMutableArray *imageList;

/**
 <#Description#>
 */
@property (nonatomic, strong) NSMutableArray *khxxDataArr;

/**
 <#Description#>
 */
@property (nonatomic, strong) UITextField *khxxTextField;

/**
 <#Description#>
 */
@property (nonatomic, strong) UITextField *khxxZJHTextField;

/**
 <#Description#>
 */
@property (nonatomic, strong) UITextField *fyBLTextField;

/**
 签约详细model
 */
@property (nonatomic, strong) GetSignedHaveAmount *getSignedHaveAmount;

/**
 推荐成交人
 */
@property (nonatomic, strong) NSMutableArray *recommendCustomerList;

/**
 推荐成交人
 */
@property (nonatomic, strong) NSMutableArray *recommendCustomerNameList;

/**
 房源
 */
@property (nonatomic, strong) RoomList *roomList;

@property (nonatomic, strong) UITableView *one1TabView;
//
@property (nonatomic, strong) UITableView *one2TabView;
//
@property (nonatomic, strong) UITableView *one3TabView;
//
@property (nonatomic, strong) UITableView *one4TabView;

//
@property (nonatomic, strong) UITableView *one5TabView;

/**
 12、证件类型
 */
@property (nonatomic, strong) NSMutableArray *zjlxList;

// 装修款开关
@property (nonatomic, assign) BOOL signOff;
@property (nonatomic, strong) UISwitch *fixOff;

@property (nonatomic, copy) NSString *fixReceivable;
@property (nonatomic, copy) NSString *fixReceivable1;
@property (nonatomic, copy) NSString *fixReceivable2;
@property (nonatomic, copy) NSString *fixReceivable3;
@property (nonatomic, copy) NSString *fixReceivable4;
@property (nonatomic, copy) NSString *fixReceivable5;
@property (nonatomic, copy) NSString *fixReceivable6;
@property (nonatomic, copy) NSString *fixReceivable7;
@property (nonatomic, copy) NSString *fixReceivable8;
@property (nonatomic, copy) NSString *fixReceivable9;
@property (nonatomic, copy) NSString *fixReceivable10;
@property (nonatomic, copy) NSString *fixReceivable11;
@property (nonatomic, copy) NSString *fixReceivable12;

@property (nonatomic, copy) NSString *fixPaymentType;
@property (nonatomic, copy) NSString *fixPaymentId;
@property (nonatomic, copy) NSString *fixReceivableDate;
@property (nonatomic, copy) NSString *fixReceivableData1;
@property (nonatomic, copy) NSString *fixReceivableData2;
@property (nonatomic, copy) NSString *fixReceivableData3;
@property (nonatomic, copy) NSString *fixReceivableData4;
@property (nonatomic, copy) NSString *fixReceivableData5;
@property (nonatomic, copy) NSString *fixReceivableData6;
@property (nonatomic, copy) NSString *fixReceivableData7;
@property (nonatomic, copy) NSString *fixReceivableData8;
@property (nonatomic, copy) NSString *fixReceivableData9;
@property (nonatomic, copy) NSString *fixReceivableData10;
@property (nonatomic, copy) NSString *fixReceivableData11;
@property (nonatomic, copy) NSString *fixReceivableData12;
@property (nonatomic, copy) NSString *fixReceivableData13;
@property (nonatomic, copy) NSString *fixReceivableData14;
@property (nonatomic, copy) NSString *fixReceivableData15;
@property (nonatomic, copy) NSString *fixReceivableData16;
@property (nonatomic, copy) NSString *fixReceivableData17;
@property (nonatomic, copy) NSString *fixReceivableData18;

@property (nonatomic, copy) NSString *fixYicxYSFKMony;
@property (nonatomic, copy) NSString *fixYicxWSFKMony;
@property (nonatomic, copy) NSString *fixFqYQYSMony;
@property (nonatomic, copy) NSString *fixFqYQWSMony;
@property (nonatomic, copy) NSString *fixFqEQYSMony;
@property (nonatomic, copy) NSString *fixFqEQWSMony;
@property (nonatomic, copy) NSString *fixFqSQYSMony;
@property (nonatomic, copy) NSString *fixFqSQWSMony;
@property (nonatomic, copy) NSString *fixFqSIQYSMony;
@property (nonatomic, copy) NSString *fixFqSIQWSMony;
@property (nonatomic, copy) NSString *fixFqWQYSMony;
@property (nonatomic, copy) NSString *fixFqWQWSMony;
@property (nonatomic, copy) NSString *fixSySFYSMony;
@property (nonatomic, copy) NSString *fixSySFWSMony;
@property (nonatomic, copy) NSString *fixSyYSMony;
@property (nonatomic, copy) NSString *fixSyWSMony;
@property (nonatomic, copy) NSString *fixGjjSFYSMony;
@property (nonatomic, copy) NSString *fixGjjSFWSMony;

@property (nonatomic, copy) NSString *fixGjjYSMony;
@property (nonatomic, copy) NSString *fixGjjWSMony;
@property (nonatomic, copy) NSString *fixZhSFYSMony;
@property (nonatomic, copy) NSString *fixZhSFWSMony;
@property (nonatomic, copy) NSString *fixZhSYYSMony;
@property (nonatomic, copy) NSString *fixZhSYWSMony;
@property (nonatomic, copy) NSString *fixZhgjjYSMony;
@property (nonatomic, copy) NSString *fixZhgjjWSMony;

// 装修款总金额
@property (nonatomic, copy) NSString *fixHouseTotal;
// 合同总金额
@property (nonatomic, copy) NSString *totalAmount;
@property (nonatomic, strong) NSMutableArray *fixHousePaymentMethods;

@property (nonatomic, assign) BOOL isHaveDian;
@end

@implementation AddNewSignViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //数组初始化
    _zyData = [[NSMutableArray alloc] init];
    
    _zyDataArr = [[NSMutableArray alloc] init];
    
    _recommendCustomerList = [[NSMutableArray alloc] init];
    
    _recommendCustomerNameList = [[NSMutableArray alloc] init];
    
    _khxxDataArr = [[NSMutableArray alloc] init];
    
    //_jJRDataArr = [[NSMutableArray alloc] init];
    
    _paymentMethodList = [[NSMutableArray alloc] init];
    self.fixHousePaymentMethods = [[NSMutableArray alloc]init];
    
    _imageList = [[NSMutableArray alloc] init];
    
    _picArray = [[NSMutableArray alloc] init];
    NSMutableDictionary *dictIm = [[NSMutableDictionary alloc] init];
    [dictIm setObject:@"image" forKey:@"image"];
    [dictIm setObject:@"type" forKey:@"type"];
    [_picArray addObject:dictIm];
    _picArray1 = [[NSMutableArray alloc] init];
    
    _picArraySele = [[NSMutableArray alloc] init];
    
    _dictionary = [[NSMutableDictionary alloc] init];
    
    _selectedArr = [[NSMutableArray alloc] initWithObjects:@"0",@"1",@"2",@"3",@"4",@"5",@"6", nil];
   
    //12、证件类型
    _zjlxList = [[NSMutableArray alloc] init];
    if (_isAdd == YES) {
        if(!self.houseDetailTo){
            [self postGetCustomerDetailApi];
        }
    }
    [self postGetDictionaryListByProjectIdApi];
    [self postGetConsultantListApi];
    [self postGetRecommendCustomerListHanderApi];
    //Api调用
    if ([NSString isStringEmpty2:self.payDepositId] == NO) {
        [self postGetConsultantListApiBusinessId:self.payDepositId businessType:@"1"];
    }else if ([NSString isStringEmpty2:self.subscribeId] == NO) {
        [self postGetConsultantListApiBusinessId:self.subscribeId businessType:@"2"];
    }else if ([NSString isStringEmpty2:self.signedId] == NO) {
        [self postGetConsultantListApiBusinessId:self.signedId businessType:@"4"];
    }else {
        [self postGetConsultantListApiBusinessId:@"" businessType:@"3"];
    }
    
//    [self creatNavigationController];
    
    [self initWithShowUI];
    //创建UITableView
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, EMM_WIDTH,EMM_HEIGHT-65-SafeAreaTopHeight) style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.showsVerticalScrollIndicator = NO;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:_tableView];
    [self initDataSource];
    //签约当前时间
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
    NSDate * date = [NSDate date];//当前时间
    _signedDate = [dateFormatter stringFromDate:date];
    
    UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [backBtn setFrame:CGRectMake(0, 0, 54 ,44)];
    [backBtn addTarget:self
                action:@selector(NewbackToPreviousPage:)
      forControlEvents:UIControlEventTouchUpInside];
    [backBtn setBackgroundColor:[UIColor clearColor]];
    [backBtn setImage:[UIImage imageNamed:@"ico_back"] forState:UIControlStateNormal];
    backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    if (EMM_WIDTH <= 320) {
        backBtn.contentEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 0);
    }else if (EMM_WIDTH > 375){
        backBtn.contentEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
    }else{
        backBtn.contentEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 0);
    }
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
    
    NSString *resetPrice = [NSString stringWithFormat:@"%.2f", [self.discountTotalPrice floatValue] * 10000];
    self.discountTotalPrice = resetPrice;
    NSString *resetAfterPrice = [NSString stringWithFormat:@"%.2f", [self.discountAfterAmount floatValue] * 10000];
    self.discountAfterAmount = resetAfterPrice;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)NewbackToPreviousPage:(id) send {
    if ([_isTransaction isEqualToString:@"1"]) {
        for (UIViewController *controller in self.navigationController.viewControllers) {
            if ([controller isKindOfClass:[SignViewController class]]) {
                [self creatNSNotificationCenter];
                SignViewController *svc =(SignViewController *)controller;
                [self.navigationController popToViewController:svc animated:YES];
            }
        }
    }else {
        [self.navigationController popViewControllerAnimated:YES];
    }
    
}


#pragma mark - 完善客户信息-认购返回的回调通知
- (void)creatNSNotificationCenter {
    NSDictionary *dict = [NSDictionary dictionaryWithObject:@"A" forKey:@"intentionLevel"];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"SignVCIntentionLevel" object:nil userInfo:dict];
}


#pragma mark - 保存和提交按钮初始化
- (void)initWithShowUI {
    _bcBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    _bcBtn.frame = CGRectMake(10, EMM_HEIGHT-65-SafeAreaTopHeight, EMM_WIDTH/2-20, 45);
    _bcBtn.backgroundColor = [UIColor colorFromHexCode:@"#f97242"];
    [_bcBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [_bcBtn setTitle:@"保存" forState:UIControlStateNormal];
    _bcBtn.layer.masksToBounds = YES;
    _bcBtn.layer.cornerRadius = 5;
    _bcBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [_bcBtn addTarget:self action:@selector(bcBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_bcBtn];
    
    _tjBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    _tjBtn.frame = CGRectMake(EMM_WIDTH/2+10, EMM_HEIGHT-65-SafeAreaTopHeight, EMM_WIDTH/2-20, 45);
    _tjBtn.backgroundColor = [UIColor colorFromHexCode:@"#c4302c"];
    [_tjBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [_tjBtn setTitle:@"提交" forState:UIControlStateNormal];
    _tjBtn.layer.masksToBounds = YES;
    _tjBtn.layer.cornerRadius = 5;
    _tjBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [_tjBtn addTarget:self action:@selector(tjBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_tjBtn];
}

#pragma mark - 导航

- (void)creatNavigationController {
    [self updateNavBar];
        
    if (_isAdd == YES) {
        self.navigationItem.title = @"新增签约";
        [self addSignShowUI];
    }else {
        self.navigationItem.title = @"修改签约";
        [self editSignShowUI];
    }
}

#pragma mark - 初始化新增数据
- (void)addSignShowUI {
    NSArray *paymentMethodArr = [NSArray arrayWithObjects:
                                 @"一次性付款",@"分期付款",@"商业按揭",
                                 @"公积金按揭 ", @"组合贷款", nil];
    for (int i = 0; i < paymentMethodArr.count; i++) {
        NSString *str = [paymentMethodArr objectAtIndex:i];
        if ([_paymentMethod isEqualToString:str]) {
            _paymentMethodId = [NSString stringWithFormat:@"%d",i+1];
        }
    }
    
    NSArray *paymentMethodArr1 = [NSArray arrayWithObjects:
                                 @"一次性付款",@"分期付款",@"商业按揭",
                                 nil];
    for (int i = 0; i < paymentMethodArr1.count; i++) {
        NSString *str = [paymentMethodArr1 objectAtIndex:i];
        if ([self.fixPaymentType isEqualToString:str]) {
            self.fixPaymentId = [NSString stringWithFormat:@"%d",i+1];
        }
    }
    
    if ([self.busReturnType isEqualToString:@"0"]) {
        [_jJRDataArr removeAllObjects];
        _dealCategory = @"单独成交";
        _dealCategoryId = @"2";
        NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
        NSString *userName = [userdf objectForKey:@"userName"];
        NSString *userId = [userdf objectForKey:@"userNameId"];
        NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
        [dict setObject:userId forKey:@"relationAgentId"];
        [dict setObject:userName forKey:@"relationAgentName"];
        [dict setObject:@"100.00" forKey:@"proportionCommission"];
        [_jJRDataArr addObject:dict];
    }
    [self calculateSellAmount];
    
}

#pragma mark - 初始化编辑数据
- (void)editSignShowUI {
    [_khxxDataArr removeAllObjects];
    [_paymentMethodList removeAllObjects];
    [self.fixHousePaymentMethods removeAllObjects];
    [_picArray1 removeAllObjects];
    [_picArray removeAllObjects];
    [_jJRDataArr removeAllObjects];
    _payDepositId = _getSignedDetail.payDepositId;           //认筹ID
    _payDepositCode = _getSignedDetail.payDepositCode;         //认筹编号
    _payDepositMoney = _getSignedDetail.payDepositMoney;        //	认筹金
    _subscribeId = _getSignedDetail.vsubscribeId;            //	认购ID
    _subscribeCode = _getSignedDetail.subscribeCode;          //	认购编号
    _subscribeAmount = _getSignedDetail.subscribeAmount;
    _signedCode = _getSignedDetail.signedCode;
    _qyRoomId = _getSignedDetail.roomId;
    _qyRoomName = _getSignedDetail.signedHouses;
    NSMutableArray *arr = [[NSMutableArray alloc] init];
    arr = _getSignedDetail.customerFamilyList;
    if (_zjlxList.count > 0) {
        for (int i = 0; i < arr.count; i++) {
            CustomerFamilyList *list = [arr objectAtIndex:i];
            NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
            [dict setObject:list.memberName forKey:@"memberName"];
            NSString *documentType = @"";
            for (int i = 0; i < _zjlxList.count; i++) {
                NSMutableDictionary *dict = [_zjlxList objectAtIndex:i];
                if ([list.documentType isEqualToString:[dict objectForKey:@"dictionaryName"]]) {
                    documentType = [dict objectForKey:@"dictionaryId"];
                }
            }
            if ([NSString isStringEmpty2:documentType] == NO) {
                [dict setObject:documentType forKey:@"documentType"];
            }else {
                [dict setObject:@"" forKey:@"documentType"];
            }
            if ([NSString isStringEmpty2:list.documentNumber] == NO) {
                [dict setObject:list.documentNumber forKey:@"documentNumber"];
            }else {
                [dict setObject:@"" forKey:@"documentNumber"];
            }
            [_khxxDataArr addObject:dict];
        }
    }
    _calculateArea = _getSignedDetail.calculateArea;
    _discountPrice = _getSignedDetail.discountPrice;
    _discountTotalPrice = _getSignedDetail.discountTotalPrice;
    _memberName = _getSignedDetail.customerName;
    _documentName = _getSignedDetail.documentType;
    for (int i = 0; i < _zjlxList.count; i++) {
        NSMutableDictionary *dict = [_zjlxList objectAtIndex:i];
        if ([_documentName isEqualToString:[dict objectForKey:@"dictionaryName"]]) {
            _documentType = [dict objectForKey:@"dictionaryId"] ;
        }
    }
    
    _discountAfterAmount = _getSignedDetail.discountAfterAmount;
    _documentNumber = _getSignedDetail.documentNumber;
    _mobile = _getSignedDetail.mobile;
    _mailPost = _getSignedDetail.mailPost;
    //计算邮寄地址textView的高度
    UITextView *mailPostTV = [[UITextView alloc] initWithFrame:CGRectMake(100, 5, EMM_WIDTH - 100, 50)];
    mailPostTV.font = [UIFont systemFontOfSize:15];
    mailPostTV.text = _mailPost;
    _mailPostTVHeight = [self heightForString:mailPostTV andWidth:EMM_WIDTH - 100];
    
    _postcode = _getSignedDetail.postcode;
    _discountApproval = _getSignedDetail.discountApproval;
    _discountAmount = _getSignedDetail.discountAmount;
    _discountRate = [NSString getMoney2:[_getSignedDetail.discountRate floatValue]];
//    _addDiscountRate = [NSString getMoney2:[_getSignedDetail.addDiscountRate floatValue]/100];
    _addDiscountRate = _getSignedDetail.addDiscountRate;
    //[NSString getMoney2:[ floatValue]/100];

    _discountNote = _getSignedDetail.discountNote;

    _contractPrice = [NSString getVal:2 val:[_getSignedDetail.signPrice floatValue]];
    _contractAmount = [NSString getVal:2 val:[_getSignedDetail.contractAmount floatValue]];
    
    _realAmount = _getSignedDetail.realAmount;
    _paymentMethod = _getSignedDetail.paymentMethod;//付款方式名称和id
    self.fixPaymentType = self.getSignedDetail.decorationPaymentMethod;
    
    NSArray *paymentMethodArr = [NSArray arrayWithObjects:
                                 @"一次性付款",@"分期付款",@"商业按揭",
                                 @"公积金按揭 ", @"组合贷款", nil];
    for (int i = 0; i < paymentMethodArr.count; i++) {
        NSString *str = [paymentMethodArr objectAtIndex:i];
        if ([_paymentMethod isEqualToString:str]) {
            _paymentMethodId = [NSString stringWithFormat:@"%d",i+1];
        }
    }
    for (PaymentMethodList *list in _getSignedDetail.paymentMethodList) {
        NSLog(@"%@",list);
        [_paymentMethodList addObject:list];
    }
    if (_paymentMethodList.count > 0) {
        if ([_paymentMethod isEqualToString:@"一次性付款"]) {
            for (int i = 0; i < _paymentMethodList.count; i++) {
                PaymentMethodList *list = [_paymentMethodList objectAtIndex:i];
                if ([list.payContent isEqualToString:@"一次性全款"]) {
                    _receivable = list.receivable;
                    _receivableDate = list.receivableDate;
                    _yicxYSFKMony = list.realAmount;
                    _yicxWSFKMony = list.notRealAmount;
                }
            }
        }else if ([_paymentMethod isEqualToString:@"分期付款"]) {
            for (int i = 0; i < _paymentMethodList.count; i++) {
                PaymentMethodList *list = [_paymentMethodList objectAtIndex:i];
                if ([list.payContent isEqualToString:@"分期一期款"]) {
                    _receivable1 = list.receivable;
                    _receivableDate1 = list.receivableDate;
                    _fqYQYSMony = list.realAmount;
                    _fqYQWSMony = list.notRealAmount;
                }else if ([list.payContent isEqualToString:@"分期二期款"]) {
                    _receivable2 = list.receivable;
                    _receivableDate2 = list.receivableDate;
                    _fqEQYSMony = list.realAmount;
                    _fqEQWSMony = list.notRealAmount;
                }else if ([list.payContent isEqualToString:@"分期三期款"]) {
                    _receivable3 = list.receivable;
                    _receivableDate3 = list.receivableDate;
                    _fqSQYSMony = list.realAmount;
                    _fqSQWSMony = list.notRealAmount;
                }else if ([list.payContent isEqualToString:@"分期四期款"]) {
                    _receivable4 = list.receivable;
                    _receivableDate4 = list.receivableDate;
                    _fqSIQYSMony = list.realAmount;
                    _fqSIQWSMony = list.notRealAmount;
                }else if ([list.payContent isEqualToString:@"分期五期款"]) {
                    _receivable5 = list.receivable;
                    _receivableDate5 = list.receivableDate;
                    _fqWQYSMony = list.realAmount;
                    _fqWQWSMony = list.notRealAmount;
                }
            }
        }else if ([_paymentMethod isEqualToString:@"商业按揭"]) {
            for (int i = 0; i < _paymentMethodList.count; i++) {
                PaymentMethodList *list = [_paymentMethodList objectAtIndex:i];
                if ([list.payContent isEqualToString:@"商业贷款首付款"]|| [list.payContent isEqualToString:@"银行按揭"]|| [list.payContent isEqualToString:@"按揭银行"]) {
                    _receivable9 = list.receivable;
                    _receivableDate9 = list.receivableDate;
                    _sySFYSMony = list.realAmount;
                    _sySFWSMony = list.notRealAmount;
                }else if ([list.payContent isEqualToString:@"商业贷款按揭款"]) {
                    _receivable10 = list.receivable;
                    _receivableDate10 = list.receivableDate;
                    _syYSMony = list.realAmount;
                    _syWSMony = list.notRealAmount;
                }
            }
        }else if ([_paymentMethod isEqualToString:@"公积金按揭"]) {
            for (int i = 0; i < _paymentMethodList.count; i++) {
                PaymentMethodList *list = [_paymentMethodList objectAtIndex:i];
                if ([list.payContent isEqualToString:@"公积金首付款"] || [list.payContent isEqualToString:@"首付款"]) {
                    _receivable11 = list.receivable;
                    _receivableDate11 = list.receivableDate;
                    _gjjSFYSMony = list.realAmount;
                    _gjjSFWSMony = list.notRealAmount;
                }else if ([list.payContent isEqualToString:@"公积金按揭款"]) {
                    _gjjYSMony = list.receivable;
                    _gjjWSMony = list.receivableDate;
                }
            }
            
        }else if ([_paymentMethod isEqualToString:@"组合贷款"]) {
            for (int i = 0; i < _paymentMethodList.count; i++) {
                PaymentMethodList *list = [_paymentMethodList objectAtIndex:i];
                if ([list.payContent isEqualToString:@"组合贷款首付款"]|| [list.payContent isEqualToString:@"首付款"]) {
                    _receivable6 = list.receivable;
                    _receivableDate6 = list.receivableDate;
                    _zhSFYSMony = list.realAmount;
                    _zhSFWSMony = list.notRealAmount;
                }else if ([list.payContent isEqualToString:@"组合贷款银行按揭"]|| [list.payContent isEqualToString:@"银行按揭"]|| [list.payContent isEqualToString:@"按揭银行"]) {
                    _receivable7 = list.receivable;
                    _receivableDate7 = list.receivableDate;
                    _zhSYYSMony = list.realAmount;
                    _zhSYWSMony = list.notRealAmount;
                }else if ([list.payContent isEqualToString:@"组合贷款公积金按揭"]) {
                    _receivable8 = list.receivable;
                    _receivableDate8 = list.receivableDate;
                    _zhgjjYSMony = list.realAmount;
                    _zhgjjWSMony = list.notRealAmount;
                }
            }
            
        }
    }
    
    _dealCategory = _getSignedDetail.dealCategory;//交易类别的名称和id
    NSArray *dealCategoryArr = [NSArray arrayWithObjects:
                                @"推荐成交",@"单独成交",@"共同成交", nil];
    for (int i = 0; i < dealCategoryArr.count; i++) {
        NSString *str = [dealCategoryArr objectAtIndex:i];
        if ([_dealCategory isEqualToString:str]) {
            _dealCategoryId = [NSString stringWithFormat:@"%d",i+1];
        }
    }
    _signedDate = _getSignedDetail.signedDate;
    _agentName = _getSignedDetail.agent;
    _remark = _getSignedDetail.remark;
    //计算备注textView的高度
    UITextView *remarkTextView = [[UITextView alloc] initWithFrame:CGRectMake(100, 5, EMM_WIDTH - 100, 50)];
    remarkTextView.font = [UIFont systemFontOfSize:15];
    remarkTextView.text = _remark;
    _remarkTVHeight = [self heightForString:remarkTextView andWidth:EMM_WIDTH - 100];
    for (ImageList *list in _getSignedDetail.imageList) {
        NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
        if ([NSString isStringEmpty2:list.smallUrl] == NO) {
            [dict setObject:list.smallUrl forKey:@"image"];
        }
        [dict setObject:@"2" forKey:@"type"];
//        [_picArray1 addObject:list.smallUrl];
        [_picArray addObject:dict];
    }
    
    NSMutableDictionary *dictIm = [[NSMutableDictionary alloc] init];
    [dictIm setObject:@"image" forKey:@"image"];
    [dictIm setObject:@"type" forKey:@"type"];
    [_picArray addObject:dictIm];
    
    for (int i = 0; i < _getSignedDetail.dealCategoryList.count; i++) {
        DealCategoryList *list = [_getSignedDetail.dealCategoryList objectAtIndex:i];
        NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
        if ([NSString isStringEmpty2:list.relationAgentId] == NO) {
            [dict setObject:list.relationAgentId forKey:@"relationAgentId"];
            
        }else {
            [dict setObject:@"" forKey:@"relationAgentId"];
        }
        if ([NSString isStringEmpty2:list.relationAgentName] == NO) {
            [dict setObject:list.relationAgentName forKey:@"relationAgentName"];
            
        }else {
            [dict setObject:@"" forKey:@"relationAgentName"];
        }
        if ([NSString isStringEmpty2:list.proportionCommission] == NO) {
            [dict setObject:list.proportionCommission forKey:@"proportionCommission"];
        }else {
            [dict setObject:@"" forKey:@"proportionCommission"];
        }
        [_jJRDataArr addObject:dict];
    }
    _floorType = _getSignedDetail.floorType;
    _referenceName = _getSignedDetail.referenceName;
    _busReturnType = _getSignedDetail.busReturnType;
    
    // 设置装修款选项
    [self prepareForFixHouseData];
    
}

- (void)prepareForFixHouseData {
    
    if (!self.getSignedDetail.decorationPaymentMethod) return;
    [self.fixOff setOn:YES];
    [self fixHouseOffClick:self.fixOff];

    NSArray *paymentMethodArr = [NSArray arrayWithObjects:
                                 @"一次性付款",@"分期付款",@"商业按揭",
                                  nil];
    for (int i = 0; i < paymentMethodArr.count; i++) {
        NSString *str = [paymentMethodArr objectAtIndex:i];
        if ([self.fixPaymentType isEqualToString:str]) {
            self.fixPaymentId = [NSString stringWithFormat:@"%d",i+1];
        }
    }
    for (PaymentMethodList *list in _getSignedDetail.decorationPaymentMethodList) {
        NSLog(@"%@",list);
        [self.fixHousePaymentMethods addObject:list];
    }
    if (self.fixHousePaymentMethods.count > 0) {
        if ([self.fixPaymentType isEqualToString:@"一次性付款"]) {
            for (int i = 0; i < self.fixHousePaymentMethods.count; i++) {
                PaymentMethodList *list = [self.fixHousePaymentMethods objectAtIndex:i];
                if ([list.payContent isEqualToString:@"一次性全款(装修款)"]) {
                    self.fixReceivable = list.receivable;
                    self.fixReceivableDate = list.receivableDate;
                    self.fixYicxYSFKMony = list.realAmount;
                    self.fixYicxWSFKMony = list.notRealAmount;
                }
            }
        }else if ([self.fixPaymentType isEqualToString:@"分期付款"]) {
            for (int i = 0; i < self.fixHousePaymentMethods.count; i++) {
                PaymentMethodList *list = [self.fixHousePaymentMethods objectAtIndex:i];
                if ([list.payContent isEqualToString:@"分期一期款(装修款)"]) {
                    self.fixReceivable1 = list.receivable;
                    
                    self.fixReceivableData1 = list.receivableDate;
                    self.fixFqYQYSMony = list.realAmount;

                    self.fixFqYQWSMony = list.notRealAmount;
                    
                }else if ([list.payContent isEqualToString:@"分期二期款(装修款)"]) {
                    self.fixReceivable2 = list.receivable;
                    self.fixReceivableData2 = list.receivableDate;
                    self.fixFqEQYSMony = list.realAmount;
                    
                    self.fixFqYQWSMony = list.notRealAmount;
                    
                }else if ([list.payContent isEqualToString:@"分期三期款(装修款)"]) {
                    self.fixReceivable3 = list.receivable;
                    self.receivableDate3 =  list.receivableDate;
                    
                    self.fixFqSQYSMony = list.realAmount;
                     self.fixFqSQWSMony = list.notRealAmount;
                   
                }else if ([list.payContent isEqualToString:@"分期四期款(装修款)"]) {
                    self.fixReceivable4 = list.receivable;
                    
                    self.fixReceivableData4 = list.receivableDate;
                    
                    self.fixFqSIQYSMony = list.realAmount;
                    
                    self.fixFqSIQWSMony = list.notRealAmount;
                    
                }else if ([list.payContent isEqualToString:@"分期五期款(装修款)"]) {
                    self.fixReceivable5  = list.receivable;
                    
                    self.fixReceivableData5 = list.receivableDate;
                    
                    self.fixFqWQYSMony = list.realAmount;
                    
                    self.fixFqWQWSMony = list.notRealAmount;
                    
                }
            }
        }else if ([self.fixPaymentType isEqualToString:@"商业按揭"]) {
            for (int i = 0; i < self.fixHousePaymentMethods.count; i++) {
                PaymentMethodList *list = [self.fixHousePaymentMethods objectAtIndex:i];
                if ([list.payContent isEqualToString:@"商业贷款首付款(装修款)"]|| [list.payContent isEqualToString:@"银行按揭(装修款)"]|| [list.payContent isEqualToString:@"按揭银行(装修款)"]) {
                    self.fixReceivable9 = list.receivable;
                    
                    self.fixReceivableData9 = list.receivableDate;
                    
                    self.fixSySFYSMony = list.realAmount;
                    
                    self.fixSySFWSMony = list.notRealAmount;
                    
                }else if ([list.payContent isEqualToString:@"商业贷款按揭款(装修款)"]) {
                    self.fixReceivable10 = list.receivable;
                    self.fixReceivableData10 = list.receivableDate;
                    
                    self.fixSyYSMony = list.realAmount;
                    self.fixSyWSMony = list.notRealAmount;
                    
                }
            }
        }
    }
    // 计算总金额
    [self calculateFixHouseTotalMoney];
    
    [self.tableView reloadData];

}

#pragma mark - 左侧数据初始化
-(void)initDataSource {
    _titleDataArray = [[NSMutableArray alloc] initWithObjects:
                       @"房源信息", @"客户信息",@"2",@"3",@"4",@"5",@"6",@"附件", nil];
    
    //分区0
    _grouparr0 = [[NSMutableArray alloc] initWithObjects:@"合同编号",@"签约房源",@"计价面积",@"折前单价",@"折前总价", nil];
    [_dictionary setValue:_grouparr0 forKey:@"0"];
    
    //分区0
    _grouparr1 = [[NSMutableArray alloc]initWithObjects:
       @"新增客户信息",@"客户姓名",@"证件类型",@"证件号码",
       @"手机号码",@"邮寄地址",@"邮  编", @"",nil];
    [_dictionary setValue:_grouparr1 forKey:@"1"];
    
    if ([NSString isStringEmpty2:_busReturnType] == NO) {
        if ([_busReturnType isEqualToString:@"0"]) {
            _grouparr2 = [[NSMutableArray alloc]initWithObjects:@"折后总价",
                          @"折扣金额",@"折扣比例",@"优惠原因",@"折扣说明",
                          @"签约单价", @"房款合同金额",@"",nil];
            _fq2Cellrow7H = 0;
        }else if ([_busReturnType isEqualToString:@"1"]) {
            _grouparr2 = [[NSMutableArray alloc]initWithObjects:@"折后总价",
                          @"折扣金额",@"折扣比例",@"优惠原因",@"折扣说明",
                          @"签约单价", @"房款合同金额",@"已收认筹金",nil];
            _fq2Cellrow7H = 50;
        }else if ([_busReturnType isEqualToString:@"2"]) {
            _grouparr2 = [[NSMutableArray alloc]initWithObjects:@"折后总价",
                          @"折扣金额",@"折扣比例",@"优惠原因",@"折扣说明",
                          @"签约单价", @"房款合同金额",@"已收认购金",nil];
            _fq2Cellrow7H = 50;
        }
    }else {
        _grouparr2 = [[NSMutableArray alloc]initWithObjects:@"折后总价",
                      @"折扣金额",@"折扣比例",@"优惠原因",@"折扣说明",
                      @"签约单价", @"房款合同金额",@"",nil];
        _fq2Cellrow7H = 0;
    }
    if ([_floorType isEqualToString:@"0"] || _floorType == nil) {
        _fq2Cellrow0H = 50;
    }else {
        _fq2Cellrow0H = 0;
    }
    _fq2Cellrow3H = 50;
    [_dictionary setValue:_grouparr2 forKey:@"2"];
    
    if ([_paymentMethod isEqualToString:@"一次性付款"]) {
        _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",
                   @"应收金额",@"已收金额",@"未收金额",@"应收日期",nil];
    }else if ([_paymentMethod isEqualToString:@"分期付款"]) {
        _grouparr3 = [[NSMutableArray alloc]initWithObjects: @"付款方式",
                   @"一期款",@"已收金额",@"未收金额",@"一期应收日期",
                   @"二期款",@"已收金额",@"未收金额",@"二期应收日期",
                   @"三期款",@"已收金额",@"未收金额",@"三期应收日期",
                   @"四期款",@"已收金额",@"未收金额",@"四期应收日期",
                   @"五期款",@"已收金额",@"未收金额",@"五期应收日期",nil];
    }else if ([_paymentMethod isEqualToString:@"商业按揭"]) {
        _grouparr3 = [[NSMutableArray alloc]initWithObjects: @"付款方式",
                   @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
                   @"商业按揭款",@"已收金额",@"未收金额",@"商业按揭应收日期", nil];
    }else if ([_paymentMethod isEqualToString:@"公积金按揭"]) {
        _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",
                   @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
                   @"公积金按揭款",@"已收金额",@"未收金额",@"公积金按揭应收日期", nil];
    }else if ([_paymentMethod isEqualToString:@"组合贷款"]) {
        _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",
                   @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
                   @"商业按揭款",@"已收金额",@"未收金额",@"商业按揭应收日期",
                   @"公积金按揭款",@"已收金额",@"未收金额",@"公积金按揭应收日期", nil];
    }else {
        _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",nil];
    }
    [_dictionary setValue:_grouparr3 forKey:@"3"];

    [self creatDataWithFixHouseAmount];
    
    
    _grouparr4 = [[NSMutableArray alloc]initWithObjects:@"成交类别", @"新增经纪人",@"",nil];
    [_dictionary setValue:_grouparr4 forKey:@"5"];
    
    _grouparr5 = [[NSMutableArray alloc]initWithObjects:@"推荐人",@"签约日期",@"备注",nil];
    
    if ([_dealCategory isEqualToString:@"推荐成交"]) {
        _fq5Cellrow0H = 50;
        _fq5Cellrow1H = 50;
    }else {
        _fq5Cellrow0H = 0;
        _fq5Cellrow1H = 0;
    }
    [_dictionary setValue:_grouparr5 forKey:@"6"];
    
    _grouparr6 = [[NSMutableArray alloc]initWithObjects:@"",nil];

    [_dictionary setValue:_grouparr6 forKey:@"7"];

}

- (UISwitch *)fixOff {
    if (!_fixOff) {
        _fixOff = [[UISwitch alloc]init];
        [_fixOff addTarget:self action:@selector(fixHouseOffClick:) forControlEvents:UIControlEventValueChanged];
    }
    return _fixOff;
}

- (void)creatDataWithFixHouseAmount {
    // 装修款
    if(self.signOff) {
        if ([self.fixPaymentType isEqualToString:@"一次性付款"]) {
            self.fixGroups = [[NSMutableArray alloc]initWithObjects:@"装修款",@"装修款总金额",@"付款方式",
                              @"应收金额",@"已收金额",@"未收金额",@"应收日期",@"合同总金额",nil];
        }else if ([self.fixPaymentType isEqualToString:@"分期付款"]) {
            self.fixGroups  = [[NSMutableArray alloc]initWithObjects:@"装修款",@"装修款总金额", @"付款方式",
                               @"一期款",@"已收金额",@"未收金额",@"一期应收日期",
                               @"二期款",@"已收金额",@"未收金额",@"二期应收日期",
                               @"三期款",@"已收金额",@"未收金额",@"三期应收日期",
                               @"四期款",@"已收金额",@"未收金额",@"四期应收日期",
                               @"五期款",@"已收金额",@"未收金额",@"五期应收日期",@"合同总金额",nil];
        }else if ([self.fixPaymentType isEqualToString:@"商业按揭"]) {
            self.fixGroups  = [[NSMutableArray alloc]initWithObjects:@"装修款",@"装修款总金额", @"付款方式",
                               @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
                               @"商业按揭款",@"已收金额",@"未收金额",@"商业按揭应收日期",@"合同总金额", nil];
        }else if ([self.fixPaymentType isEqualToString:@"公积金按揭"]) {
            self.fixGroups  = [[NSMutableArray alloc]initWithObjects:@"装修款",@"装修款总金额",@"付款方式",
                               @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
                               @"公积金按揭款",@"已收金额",@"未收金额",@"公积金按揭应收日期",@"合同总金额", nil];
        }else if ([self.fixPaymentType isEqualToString:@"组合贷款"]) {
            self.fixGroups  = [[NSMutableArray alloc]initWithObjects:@"装修款",@"装修款总金额",@"付款方式",
                               @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
                               @"商业按揭款",@"已收金额",@"未收金额",@"商业按揭应收日期",
                               @"公积金按揭款",@"已收金额",@"未收金额",@"公积金按揭应收日期",@"合同总金额", nil];
        }else {
            self.fixGroups  = [[NSMutableArray alloc]initWithObjects:@"装修款",@"装修款总金额",@"付款方式",nil];
        }
        
    }else {
        self.fixGroups = [[NSMutableArray alloc]initWithObjects:@"装修款", nil];
    }
    [_dictionary setValue:self.fixGroups forKey:@"4"];

}

#pragma mark - methods
- (void)openClientPageClick {
    NSLog(@"111111111");
    // 跳转客户选择页面
    EMMTouristsViewController *evc = [[EMMTouristsViewController alloc] init];
    evc.hidesBottomBarWhenPushed = YES;
    evc.tourSring = @"4";
    evc.titleString = @"选择客户";
    evc.suanjiaTpye = @"1";
    [self.navigationController pushViewController:evc animated:YES];
    [evc setTouristsBlock:^(NSMutableArray *dataArr) {
        CustomerList *userModel = dataArr.firstObject;
        self.customerId = userModel.customerId;
//        self.getSubscribeDetail.customerName = userModel.customerName;
//        self.getSubscribeDetail.mobile = userModel.mobile;
//        self.customerId = userModel.customerId;
//        [self.addSubscriptionTableView reloadData];
        [self postGetCustomerDetailApi];
        
    }];

}

- (void)fixHouseOffClick:(UISwitch *)Onoff {
    NSLog(@"---------------");
    self.signOff = Onoff.isOn;
    [self creatDataWithFixHouseAmount];
    [self.tableView reloadData];
//
//    NSArray *arr = [NSArray arrayWithObjects:
//                    @"一次性付款",@"分期付款",@"商业按揭",
//                    @"公积金按揭", @"组合贷款", nil];
//    ShowMenuView *menuView = [[ShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) title:@"选项" titleNmae:@"请选择付款方式" numLits:nil items:arr];
//    menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
//    [[UIApplication sharedApplication].keyWindow addSubview:menuView];
//    __block ShowMenuView *weakMenuView = menuView;
//    __block AddNewSignViewController *blockSelf = self;
//    [menuView setTouchBlock:^(NSString *indet, NSString *numberId) {
//        if ([NSString isStringEmpty2:indet] == NO) {
//            _paymentMethod = indet;
//            _paymentMethodId = numberId;
//
//            if ([_paymentMethod isEqualToString:@"一次性付款"]) {
//                _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",
//                              @"应收金额",@"已收金额",@"未收金额",@"应收日期",nil];
//            }else if ([_paymentMethod isEqualToString:@"分期付款"]) {
//                _grouparr3 = [[NSMutableArray alloc]initWithObjects: @"付款方式",
//                              @"一期款",@"已收金额",@"未收金额",@"一期应收日期",
//                              @"二期款",@"已收金额",@"未收金额",@"二期应收日期",
//                              @"三期款",@"已收金额",@"未收金额",@"三期应收日期",
//                              @"四期款",@"已收金额",@"未收金额",@"四期应收日期",
//                              @"五期款",@"已收金额",@"未收金额",@"五期应收日期",nil];
//            }else if ([_paymentMethod isEqualToString:@"商业按揭"]) {
//                _grouparr3 = [[NSMutableArray alloc]initWithObjects: @"付款方式",
//                              @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
//                              @"商业按揭款",@"已收金额",@"未收金额",@"商业按揭应收日期", nil];
//            }else if ([_paymentMethod isEqualToString:@"公积金按揭"]) {
//                _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",
//                              @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
//                              @"公积金按揭款",@"已收金额",@"未收金额",@"公积金按揭应收日期", nil];
//            }else if ([_paymentMethod isEqualToString:@"组合贷款"]) {
//                _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",
//                              @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
//                              @"商业按揭款",@"已收金额",@"未收金额",@"商业按揭应收日期",
//                              @"公积金按揭款",@"已收金额",@"未收金额",@"公积金按揭应收日期", nil];
//            }else {
//                _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",nil];
//            }
//            [_dictionary setValue:_grouparr3 forKey:@"3"];
//        }
//        [weakMenuView removeFromSuperview];
//        [blockSelf.tableView reloadData];
//    }];
    
}


- (void)displayCell:(AddSubscriptionCell *)cell indexPath:(NSIndexPath *)indexPath {
    NSInteger indx = indexPath.row;
    if (indexPath.section  == 4) {
        if (indexPath.row == 1) {
            NSString *money = [NSString stringWithFormat:@"%.2f", [self.fixHouseTotal floatValue]];
            cell.subTitleLabel.text = [NSString stringWithFormat:@"%@元", money? : @""];
            cell.subTitleLabel.textColor = [UIColor blackColor];
        }
        indx -= 2;
    }
    BOOL fixHouseGroup = indexPath.section == 4;
    NSString *methodType = fixHouseGroup ? self.fixPaymentType : _paymentMethod;
    
    if (indx == 0) {
        cell.biaoxinL.hidden = NO;
        cell.biaoxinL.text = @"*";
        cell.btn_qiaoJImageV.hidden = NO;
        if ([NSString isStringEmpty2:methodType] == NO) {
            cell.subTitleLabel.text = methodType;
            cell.subTitleLabel.textColor = [UIColor blackColor];
        }else {
            cell.subTitleLabel.text = @"未选择";
            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
        }
    }else {
        if ([NSString isStringEmpty2:methodType] == NO) {
            if ([methodType isEqualToString:@"一次性付款"]) {
                if (indx == 1) {
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivableTextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivableTextFile.tag = indexPath.section;
                    _receivableTextFile.delegate = self;
                    _receivableTextFile.returnKeyType =UIReturnKeyDone;
                    _receivableTextFile.placeholder = @"请输入";
                    _receivableTextFile.textAlignment = NSTextAlignmentRight;
                    _receivableTextFile.font = [UIFont systemFontOfSize:15];
                    _receivableTextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    [cell addSubview:_receivableTextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable] == NO) {
                            _receivableTextFile.text = self.fixReceivable;
                            
                        }else {
                            _receivableTextFile.placeholder = @"请输入";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_receivable] == NO) {
                            _receivableTextFile.text = _receivable;
                            
                        }else {
                            _receivableTextFile.placeholder = @"请输入";
                        }

                    }
                    
                }else if (indx == 2) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixYicxYSFKMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixYicxYSFKMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_yicxYSFKMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_yicxYSFKMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 3) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixYicxWSFKMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixYicxWSFKMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_yicxWSFKMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_yicxWSFKMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                    
                }else if (indx == 4) {
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    cell.btn_qiaoJImageV.hidden = NO;
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableDate] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableDate;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate] == NO) {
                            cell.subTitleLabel.text = _receivableDate;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }
                    
                }else if (indx == 5) { // 装修款合同总金额
                    cell.subTitleLabel.text = [NSString stringWithFormat:@"%.2f元", [self.totalAmount floatValue]];
                    cell.subTitleLabel.textColor = [UIColor blackColor];
                    
                }
            }else if ([methodType isEqualToString:@"分期付款"]) {
                if (indx == 1) {//1
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable1TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable1TextFile.tag = indexPath.section;
                    _receivable1TextFile.delegate = self;
                    _receivable1TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable1TextFile.placeholder = @"请输入";
                    _receivable1TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable1TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable1TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    [cell addSubview:_receivable1TextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable1] == NO) {
                            _receivable1TextFile.text = [NSString stringWithFormat:@"%.2f", [self.fixReceivable1 floatValue]];//;
                            
                        }else {
                            _receivable1TextFile.placeholder = @"请输入";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_receivable1] == NO) {
                            _receivable1TextFile.text =  [NSString stringWithFormat:@"%.2f", [_receivable1 floatValue]];
                            
                        }else {
                            _receivable1TextFile.placeholder = @"请输入";
                        }
                    }
                    
                }else if (indx == 2) {
                    if(fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixFqYQYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixFqYQYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_fqYQYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_fqYQYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 3) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixFqYQWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixFqYQWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_fqYQWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_fqYQWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                    
                }else if (indx == 4) {//1
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    cell.btn_qiaoJImageV.hidden = NO;
                    if(fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData1] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData1;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate1] == NO) {
                            cell.subTitleLabel.text = _receivableDate1;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }
                   
                }else if (indx == 5) {//2
                    //                        cell.bitianLabel.hidden = NO;
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable2TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable2TextFile.delegate = self;
                    _receivable2TextFile.tag = indexPath.section;
                    _receivable2TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable2TextFile.placeholder = @"请输入";
                    _receivable2TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable2TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable2TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    [cell addSubview:_receivable2TextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable2] == NO) {
                            _receivable2TextFile.text = [NSString stringWithFormat:@"%.2f", [self.fixReceivable2 floatValue]];//self.fixReceivable2;
                            
                        }else {
                            _receivable2TextFile.placeholder = @"请输入";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_receivable2] == NO) {
                            _receivable2TextFile.text = [NSString stringWithFormat:@"%.2f", [_receivable2 floatValue]];
                            
                        }else {
                            _receivable2TextFile.placeholder = @"请输入";
                        }
                    }

                }else if (indx == 6) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixFqEQYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixFqEQYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_fqEQYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_fqEQYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }

                }else if (indx == 7) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixFqEQWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixFqEQWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_fqEQWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_fqEQWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                    
                }else if (indx == 8) {//2
                    //                        cell.bitianLabel.hidden = NO;
                    cell.btn_qiaoJImageV.hidden = NO;
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData2] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData2;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate2] == NO) {
                            cell.subTitleLabel.text = _receivableDate2;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }
                   
                }else if (indx == 9) {//3
                    
                    
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable3TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable3TextFile.delegate = self;
                    _receivable3TextFile.tag = indexPath.section;
                    _receivable3TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable3TextFile.placeholder = @"请输入";
                    _receivable3TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable3TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable3TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    [cell addSubview:_receivable3TextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable3] == NO) {
                            _receivable3TextFile.text = [NSString stringWithFormat:@"%.2f元",[self.fixReceivable3 floatValue]];
                        }else {
                            _receivable3TextFile.placeholder = @"请输入";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivable3] == NO) {
                            _receivable3TextFile.text = [NSString stringWithFormat:@"%.2f元",[_receivable3 floatValue]];
                        }else {
                            _receivable3TextFile.placeholder = @"请输入";
                        }
                        
                    }
                   
                }else if (indx == 10) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixFqSQYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixFqSQYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_fqSQYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_fqSQYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 11) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixFqSQWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixFqSQWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        
                        if ([NSString isStringEmpty2:_fqSQWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_fqSQWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                    
                }else if (indx == 12) {//3
                    //                        cell.bitianLabel.hidden = NO;
                    cell.btn_qiaoJImageV.hidden = NO;
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData3] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData3;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }else {
                        
                        if ([NSString isStringEmpty2:_receivableDate3] == NO) {
                            cell.subTitleLabel.text = _receivableDate3;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }
                    
                }else if (indx == 13) {//4
                    
                    
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable4TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable4TextFile.tag = indexPath.section;
                    _receivable4TextFile.delegate = self;
                    _receivable4TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable4TextFile.placeholder = @"请输入";
                    _receivable4TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable4TextFile.font = [UIFont systemFontOfSize:15];
                    _receivableTextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    [cell addSubview:_receivable4TextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable4] == NO) {
                            _receivable4TextFile.text =  [NSString stringWithFormat:@"%.2f",[self.fixReceivable4 floatValue]];
                        }else {
                            _receivable4TextFile.placeholder = @"请输入";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivable4] == NO) {
                            _receivable4TextFile.text = [NSString stringWithFormat:@"%.2f",[_receivable4 floatValue]];
                        }else {
                            _receivable4TextFile.placeholder = @"请输入";
                        }
                    }
                    
                }else if (indx == 14) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixFqSIQYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixFqSIQYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_fqSIQYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_fqSIQYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                    
                }else if (indx == 15) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixFqSIQWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixFqSIQWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_fqSIQWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_fqSIQWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 16) {//4
                    //                        cell.bitianLabel.hidden = NO;
                    cell.btn_qiaoJImageV.hidden = NO;
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData4] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData4;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate4] == NO) {
                            cell.subTitleLabel.text = _receivableDate4;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }
                    
                   
                }else if (indx == 17) {//5
                    
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable5TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable5TextFile.delegate = self;
                    _receivable5TextFile.tag = indexPath.section;
                    _receivable5TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable5TextFile.placeholder = @"请输入";
                    _receivable5TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable5TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable5TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    
                    [cell addSubview:_receivable5TextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable5] == NO) {
                            _receivable5TextFile.text = [NSString stringWithFormat:@"%.2f",[self.fixReceivable5 floatValue]];
                        }else {
                            _receivable5TextFile.placeholder = @"请输入";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_receivable5] == NO) {
                            _receivable5TextFile.text = [NSString stringWithFormat:@"%.2f",[_receivable5 floatValue]];
                        }else {
                            _receivable5TextFile.placeholder = @"请输入";
                        }
                    }
                    
                }else if (indx == 18) {
                    if (fixHouseGroup) {
                        
                        if ([NSString isStringEmpty2:self.fixFqWQYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixFqWQYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_fqWQYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_fqWQYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                }else if (indx == 19) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixFqWQWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixFqWQWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_fqWQWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_fqWQWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 20) {//5
                    //                        cell.bitianLabel.hidden = NO;
                    cell.btn_qiaoJImageV.hidden = NO;
                    if(fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData5] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData5;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate5] == NO) {
                            cell.subTitleLabel.text = _receivableDate5;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }
                   
                }else if (indx == 21) { // 装修款@"合同总金额"
                     cell.subTitleLabel.text = [NSString stringWithFormat:@"%.2f元", [self.totalAmount floatValue]];
                    cell.subTitleLabel.textColor = [UIColor blackColor];
                }
            }else if ([methodType isEqualToString:@"商业按揭"]) {
                if (indx == 1) {//9
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable9TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable9TextFile.delegate = self;
                    _receivable9TextFile.tag = indexPath.section;
                    _receivable9TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable9TextFile.placeholder = @"请输入";
                    _receivable9TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable9TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable9TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    
                    [cell addSubview:_receivable9TextFile];
                    if(fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable9] == NO) {
                            _receivable9TextFile.text = [NSString stringWithFormat:@"%.2f", [self.fixReceivable9 floatValue]];
                        }else {
                            _receivable9TextFile.placeholder = @"请输入";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivable9] == NO) {
                            _receivable9TextFile.text = [NSString stringWithFormat:@"%.2f", [_receivable9 floatValue]];
                        }else {
                            _receivable9TextFile.placeholder = @"请输入";
                        }
                    }
                   
                }else if (indx == 2) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixSySFYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixSySFYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_sySFYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_sySFYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 3) {
                    if(fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixSySFWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixSySFWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_sySFWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_sySFWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                    
                }else if (indx == 4) {//9
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    cell.btn_qiaoJImageV.hidden = NO;
                    if(fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData9] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData9;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate9] == NO) {
                            cell.subTitleLabel.text = _receivableDate9;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                            
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }
                   
                }else if (indx == 5) {//10
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable10TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable10TextFile.delegate = self;
                    _receivable10TextFile.tag = indexPath.section;
                    _receivable10TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable10TextFile.placeholder = @"请输入";
                    _receivable10TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable10TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable10TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    
                    [cell addSubview:_receivable10TextFile];
                    if(fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable10] == NO) {
                            _receivable10TextFile.text = [NSString stringWithFormat:@"%.2f",[self.fixReceivable10 floatValue]];
                        }else {
                            _receivable10TextFile.placeholder = @"请输入";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivable10] == NO) {
                            _receivable10TextFile.text = [NSString stringWithFormat:@"%.2f",[_receivable10 floatValue]];
                        }else {
                            _receivable10TextFile.placeholder = @"请输入";
                        }
                    }
                    
                }else if (indx == 6) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixSyYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixSyYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_syYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_syYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 7) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixSyWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixSyWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_syWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_syWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 8) {//10
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    cell.btn_qiaoJImageV.hidden = NO;
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData10] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData10;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate10] == NO) {
                            cell.subTitleLabel.text = _receivableDate10;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                            
                        }
                    }
      
                }else if (indx == 9) { // 装修款@"合同总金额"
                    cell.subTitleLabel.text = [NSString stringWithFormat:@"%.2f元", [self.totalAmount floatValue]];;
                    cell.subTitleLabel.textColor = [UIColor blackColor];
                }
            }else if ([methodType isEqualToString:@"公积金按揭"]) {
                if (indx == 1) {//11
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable11TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable11TextFile.delegate = self;
                    _receivable11TextFile.tag = indexPath.section;
                    _receivable11TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable11TextFile.placeholder = @"请输入";
                    _receivable11TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable11TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable11TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    
                    [cell addSubview:_receivable11TextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable11] == NO) {
                            _receivable11TextFile.text = [NSString stringWithFormat:@"%.2f", [self.fixReceivable11 floatValue]];
                        }else {
                            _receivable11TextFile.placeholder = @"请输入";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_receivable11] == NO) {
                            _receivable11TextFile.text = [NSString stringWithFormat:@"%.2f", [_receivable11 floatValue]];
                        }else {
                            _receivable11TextFile.placeholder = @"请输入";
                        }
                    }
                   
                }else if (indx == 2) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixGjjSFYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixGjjSFYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_gjjSFYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_gjjSFYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                    
                }else if (indx == 3) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixGjjSFWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixGjjSFWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_gjjSFWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_gjjSFWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                    
                }else if (indx == 4) {//11
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    
                    cell.btn_qiaoJImageV.hidden = NO;
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData11] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData11;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }

                    }else {
                        
                        if ([NSString isStringEmpty2:_receivableDate11] == NO) {
                            cell.subTitleLabel.text = _receivableDate11;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }
                }else if (indx == 5) {//12
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable12TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable12TextFile.delegate = self;
                    _receivable12TextFile.tag = indexPath.section;
                    _receivable12TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable12TextFile.placeholder = @"请输入";
                    _receivable12TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable12TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable12TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    [cell addSubview:_receivable12TextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable12] == NO) {
                            _receivable12TextFile.text = [NSString stringWithFormat:@"%.2f",[self.fixReceivable12 floatValue]];
                        }else {
                            _receivable12TextFile.placeholder = @"请输入";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_receivable12] == NO) {
                            _receivable12TextFile.text = [NSString stringWithFormat:@"%.2f",[_receivable12 floatValue]];
                        }else {
                            _receivable12TextFile.placeholder = @"请输入";
                        }
                    }
                   
                }else if (indx == 6) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixGjjYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixGjjYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_gjjYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_gjjYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                    
                }else if (indx == 7) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixGjjWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixGjjWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_gjjWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_gjjWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                  
                }else if (indx == 8) {//7
                    cell.btn_qiaoJImageV.hidden = NO;
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData12] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData12;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate12] == NO) {
                            cell.subTitleLabel.text = _receivableDate12;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }
                    
                }
            }else if ([methodType isEqualToString:@"组合贷款"]) {
                if (indx == 1) {//6
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable6TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable6TextFile.delegate = self;
                    _receivable6TextFile.tag = indexPath.section;
                    _receivable6TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable6TextFile.placeholder = @"请输入";
                    _receivable6TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable6TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable6TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    
                    [cell addSubview:_receivable6TextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable6] == NO) {
                            _receivable6TextFile.text = [NSString stringWithFormat:@"%.2f",[self.fixReceivable6 floatValue]];
                        }else {
                            _receivable6TextFile.placeholder = @"请输入";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_receivable6] == NO) {
                            _receivable6TextFile.text = [NSString stringWithFormat:@"%.2f",[_receivable6 floatValue]];;
                        }else {
                            _receivable6TextFile.placeholder = @"请输入";
                        }
                    }
                    
                }else if (indx == 2) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixZhSFYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixZhSFYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                        
                    }else {
                        if ([NSString isStringEmpty2:_zhSFYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_zhSFYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                  
                }else if (indx == 3) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixZhSFWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_zhSFWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_zhSFWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_zhSFWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 4) {//6
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    
                    cell.btn_qiaoJImageV.hidden = NO;
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData6] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData6;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate6] == NO) {
                            cell.subTitleLabel.text = _receivableDate6;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }
                    
                }else if (indx == 5) {//7
                    
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable7TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable7TextFile.delegate = self;
                    _receivable7TextFile.tag = indexPath.section;
                    _receivable7TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable7TextFile.placeholder = @"请输入";
                    _receivable7TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable7TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable7TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    
                    [cell addSubview:_receivable7TextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable7] == NO) {
                            _receivable7TextFile.text = [NSString stringWithFormat:@"%.2f",[self.fixReceivable7 floatValue]];
                        }else {
                            _receivable7TextFile.placeholder = @"请输入";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivable7] == NO) {
                            _receivable7TextFile.text = [NSString stringWithFormat:@"%.2f",[_receivable7 floatValue]];;
                        }else {
                            _receivable7TextFile.placeholder = @"请输入";
                        }
                    }
                    
                }else if (indx == 6) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixZhSYYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixZhSYYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_zhSYYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_zhSYYSMony floatValue] ];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 7) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixZhSYWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixZhSYWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_zhSYWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_zhSYWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 8) {//7
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    
                    cell.btn_qiaoJImageV.hidden = NO;
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData7] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData7;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate7] == NO) {
                            cell.subTitleLabel.text = _receivableDate7;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }
                    
                }else if (indx == 9) {//8
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    _receivable8TextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-35, 10, 200, 30)];
                    _receivable8TextFile.delegate = self;
                    _receivable8TextFile.tag = indexPath.section;
                    _receivable8TextFile.returnKeyType =UIReturnKeyDone;
                    _receivable8TextFile.placeholder = @"请输入";
                    _receivable8TextFile.textAlignment = NSTextAlignmentRight;
                    _receivable8TextFile.font = [UIFont systemFontOfSize:15];
                    _receivable8TextFile.keyboardType = UIKeyboardTypeDecimalPad;
                    
                    [cell addSubview:_receivable8TextFile];
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivable8] == NO) {
                            _receivable8TextFile.text = [NSString stringWithFormat:@"%.2f",[self.fixReceivable8 floatValue]];
                        }else {
                            _receivable8TextFile.placeholder = @"请输入";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivable8] == NO) {
                            _receivable8TextFile.text = [NSString stringWithFormat:@"%.2f",[_receivable8 floatValue]];
                        }else {
                            _receivable8TextFile.placeholder = @"请输入";
                        }
                    }
                   
                }else if (indx == 10) {
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixZhgjjYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixZhgjjYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_zhgjjYSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_zhgjjYSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                 
                }else if (indx == 11) {
                    if (fixHouseGroup) {
                        
                        if ([NSString isStringEmpty2:self.fixZhgjjWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[self.fixZhgjjWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }else {
                        if ([NSString isStringEmpty2:_zhgjjWSMony] == NO) {
                            cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_zhgjjWSMony floatValue]];
                        }else {
                            cell.subtitleOneLable.text = @"元";
                        }
                    }
                   
                }else if (indx == 12) {//8
                    cell.biaoxinL.hidden = NO;
                    cell.biaoxinL.text = @"*";
                    cell.btn_qiaoJImageV.hidden = NO;
                    if (fixHouseGroup) {
                        if ([NSString isStringEmpty2:self.fixReceivableData8] == NO) {
                            cell.subTitleLabel.text = self.fixReceivableData8;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }else {
                        if ([NSString isStringEmpty2:_receivableDate8] == NO) {
                            cell.subTitleLabel.text = _receivableDate8;
                            cell.subTitleLabel.textColor = [UIColor blackColor];
                        }else {
                            cell.subTitleLabel.text = @"未选择";
                            cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                        }
                    }
                    
                    
                }
            }
        }
    }
    
}


#pragma mark----tableViewDelegate
//返回几个表头
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return _titleDataArray.count;
}

//每一个表头下返回几行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    NSString *string = [NSString stringWithFormat:@"%ld",section];
    if ([_selectedArr containsObject:string]) {
        NSArray *array1 = _dictionary[string];
        return array1.count;
    }
    return 0;
}

//设置表头的高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    if (section == 2 || section == 3 || section == 4 || section == 5 || section == 6) {
        return 0.01f;
    }
    return 50.0f;
}

//Section Footer的高度
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    if (section == 2 || section == 3 || section == 4 || section == 5 || section == 6) {
        return 0.01f;
    }
    return 5;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    if (section == 2 || section == 3 || section == 4 || section == 5 || section == 6) {
        return nil;
    }
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, EMM_WIDTH, 5)];
    view.backgroundColor = [UIColor whiteColor];
    return view;
}

//设置view，将替代titleForHeaderInSection方法
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    if (section == 2 || section == 3 || section == 4 || section == 5 || section == 6) {
        return nil;
    }
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, EMM_WIDTH, 50)];
    view.backgroundColor = [UIColor whiteColor];
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 15, tableView.frame.size.width-20, 20)];
    titleLabel.text = [_titleDataArray objectAtIndex:section];
    titleLabel.font = [UIFont systemFontOfSize:16];
    titleLabel.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
    [view addSubview:titleLabel];
    UIImageView *lineImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 49.5, EMM_WIDTH, 0.5)];
    lineImage.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 0, EMM_WIDTH, 50);
    button.tag = 100+section;
    [button addTarget:self action:@selector(doButton:) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:button];
    view.backgroundColor = [UIColor colorFromHexCode:@"#fff5e9"];
    UILabel *sLabel6 = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, 4, 30)];
    sLabel6.backgroundColor = [UIColor colorFromHexCode:@"#ff7200"];
    [view addSubview:sLabel6];
    UIImageView *upImageView = [[UIImageView alloc] initWithFrame:CGRectMake(EMM_WIDTH-30, 20, 20, 10)];
    [view addSubview:upImageView];
    NSString *string = [NSString stringWithFormat:@"%ld",section];
    if ([_selectedArr containsObject:string]) {
        upImageView.image = [UIImage imageNamed:@"sanjt_down"];
    }else {
        upImageView.image = [UIImage imageNamed:@"sanjt_up"];
    }
   
    return view;
}

//返回row高度
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        
    }else if (indexPath.section == 1) {
        if (indexPath.row == 5) {
            if (_mailPostTVHeight == 0) {
                _mailPostTVHeight = 34;
            }
            return _mailPostTVHeight + 16;
        }
        if (indexPath.row == 7) {
            return _khxxDataArr.count * 200;
        }
        return 50;
    }else if (indexPath.section == 2) {
        if (indexPath.row == 0) {
            return _fq2Cellrow0H;
        }else if (indexPath.row == 3) {
            return _fq2Cellrow3H;
        }else if (indexPath.row == 7) {
            return _fq2Cellrow7H;
        }
        return 50;
    }else if (indexPath.section == 4) { // 装修款
        
    }
    else if (indexPath.section == 5) {
        if (indexPath.row == 2) {
            return _jJRDataArr.count * 150;
        }
        return 50;
    }else if (indexPath.section == 6) {
        if (indexPath.row == 0) {
            return _fq5Cellrow0H;
        }else if (indexPath.row == 2) {
            if (_remarkTVHeight == 0) {
                _remarkTVHeight = 34;
            }
            return _remarkTVHeight + 16;
        }
        return 50;
    }else if (indexPath.section == 7) {
        NSInteger colx = _picArray.count%3;
        NSInteger coly = _picArray.count/3;
        
        if (colx != 0) {
            coly = coly + 1;
        }
        
        CGFloat appMargin=(EMM_WIDTH-3*100)/(3+1);
        
        return (100+appMargin)*coly;
        
    }
    return 50;
}



//创建cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
#pragma mark - 最外层 tableView
    NSString *indexStr = [NSString stringWithFormat:@"%ld",indexPath.section];
    static NSString *CellIdentifier = @"AddSubscriptionCellId";
    AddSubscriptionCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"AddSubscriptionCell" owner:self options:nil] lastObject];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if ([_selectedArr containsObject:indexStr]) {
        cell.titleLabel.text = _dictionary[indexStr][indexPath.row];
    }
#pragma mark - 分区0
    if ([indexStr isEqualToString:@"0"]) {
        UIImageView *lineImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 49.5, EMM_WIDTH-20, 0.5)];
        lineImage.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
        [cell addSubview:lineImage];
        
        if (indexPath.row == 0) {
            _signedCodeTextFile = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-15, 10, 200, 30)];
            _signedCodeTextFile.delegate = self;
            _signedCodeTextFile.returnKeyType =UIReturnKeyDone;
            _signedCodeTextFile.textAlignment = NSTextAlignmentRight;
            _signedCodeTextFile.font = [UIFont systemFontOfSize:15];
            [cell addSubview:_signedCodeTextFile];
            if ([NSString isStringEmpty2:_signedCode] == NO) {
                _signedCodeTextFile.text = _signedCode;
            }else {
                _signedCodeTextFile.placeholder = @"请输入合同编号";
            }
        }else if (indexPath.row == 1) {
            cell.biaoxinL.hidden = NO;
            cell.biaoxinL.text = @"*";
            cell.btn_qiaoJImageV.hidden = NO;
            if ([NSString isStringEmpty2:_qyRoomName] == NO) {
                cell.subTitleLabel.text = _qyRoomName;
                cell.subTitleLabel.textColor = [UIColor blackColor];
            }else {
                cell.subTitleLabel.text = @"未选择";
                cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
            }
            cell.btn_qiaoJImageV.hidden = self.houseDetailTo;
        }else if (indexPath.row == 2) {
            if ([NSString isStringEmpty2:_calculateArea] == YES) {
                cell.subtitleOneLable.text =@"m²";
            }else {
                cell.subtitleOneLable.text = [NSString stringWithFormat:@"%@m²",_calculateArea];
            }
        }else if (indexPath.row == 3) {
            if ([NSString isStringEmpty2:_discountPrice] == YES) {
                cell.subtitleOneLable.text =@"元";
            }else {
                cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_discountPrice floatValue]];
            }
        }else if (indexPath.row == 4) {
            if ([NSString isStringEmpty2:_discountTotalPrice] == YES) {
                cell.subtitleOneLable.text =@"元";
            }else {
                cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_discountTotalPrice floatValue]];
            }
        }
    }else if ([indexStr isEqualToString:@"1"]) {
#pragma mark - 分区1
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        UIImageView *lineImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 49.5, EMM_WIDTH-20, 0.5)];
        lineImage.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
        [cell addSubview:lineImage];
        
        if (indexPath.row == 0) {
            UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(EMM_WIDTH-40, 10, 30, 30)];
            imageView.image = [UIImage imageNamed:@"rc_add"];
            [cell addSubview:imageView];
            cell.seleBtn.hidden = NO;
            [cell.seleBtn addTarget:self action:@selector(newKHCYBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        }else if (indexPath.row == 1) {
            /**
             *  功能描述：
             *  1.修改姓名可以更改
             *  创建时间：16/11/22
             *
             *  更新时间：2017/02/17 下午
             *  更新人： wangguiping
             */
            cell.biaoxinL.hidden = NO;
            cell.biaoxinL.text = @"*";
//            cell.subtitleOneLable.text = _memberName;
            
            _memberNameTextField = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-10, 10, 200, 30)];
            _memberNameTextField.delegate = self;
            _memberNameTextField.returnKeyType =UIReturnKeyDone;
            _memberNameTextField.textAlignment = NSTextAlignmentRight;
            _memberNameTextField.font = [UIFont systemFontOfSize:15];
            [cell addSubview:_memberNameTextField];
            if ([NSString isStringEmpty2:_memberName] == YES) {
                _memberNameTextField.placeholder = @"请选择客户";
            }else {
                _memberNameTextField.text = _memberName;
            }
            // 点击跳转客户列表页面
            if(self.houseDetailTo) {
                _memberNameTextField.userInteractionEnabled = NO;
                cell.seleBtn.hidden = NO;
                [cell.seleBtn addTarget:self action:@selector(openClientPageClick) forControlEvents:UIControlEventTouchUpInside];
            }
            
        }else if (indexPath.row == 2) {
            cell.biaoxinL.hidden = NO;
            cell.biaoxinL.text = @"*";
            cell.btn_qiaoJImageV.hidden = NO;
            if ([NSString isStringEmpty2:_documentName] == YES) {
                cell.subTitleLabel.text = @"未选择证件类型";
                cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#CCCCCC"];
            }else {
                cell.subTitleLabel.text = _documentName;
            }
            
        }else if (indexPath.row == 3) {
            cell.biaoxinL.hidden = NO;
            cell.biaoxinL.text = @"*";
            _khZJHTextField = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-15, 10, 200, 30)];
            _khZJHTextField.delegate = self;
            _khZJHTextField.returnKeyType =UIReturnKeyDone;
            _khZJHTextField.textAlignment = NSTextAlignmentRight;
            _khZJHTextField.font = [UIFont systemFontOfSize:15];
            [cell addSubview:_khZJHTextField];
            if ([NSString isStringEmpty2:_documentNumber] == YES) {
                _khZJHTextField.placeholder = @"请输入证件号";
                
            }else {
                _khZJHTextField.text = _documentNumber;
            }
        }else if (indexPath.row == 4) {
            cell.biaoxinL.hidden = NO;
            cell.biaoxinL.text = @"*";
            if ([NSString isStringEmpty2:_mobile] == YES) {
                cell.subtitleOneLable.text = @"";
            }else {
                cell.subtitleOneLable.text = _mobile;
            }
        }else if (indexPath.row == 5) {

            //邮寄地址
            cell.subOneTF.hidden = YES;
            _mailPostTV = [[UITextView alloc] initWithFrame:CGRectMake(60 + 30, 5, EMM_WIDTH-100, _mailPostTVHeight + 6)];
            _mailPostTV.delegate = self;
            _mailPostTV.returnKeyType =UIReturnKeyDone;
            _mailPostTV.textAlignment = NSTextAlignmentRight;
            [cell addSubview:_mailPostTV];
            _mailPostTV.font = [UIFont systemFontOfSize:15];
            if ([NSString isStringEmpty2:_mailPost] == NO) {
                _mailPostTV.text = _mailPost;
                _mailPostTV.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
            }else {
                _mailPostTV.text = @"请输入邮寄地址";
                _mailPostTV.textColor = [UIColor colorFromHexCode:@"#CCCCCC"];
            }
            lineImage.hidden = YES;
            UIImageView *lineImage1 = [[UIImageView alloc] init];
            lineImage1.frame = CGRectMake(10, _mailPostTVHeight + 16 - 0.5, EMM_WIDTH - 20, 0.5);
            lineImage1.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
            [cell addSubview:lineImage1];
        }else if (indexPath.row == 6) {

            _khYBTextField = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-15, 10, 200, 30)];
            _khYBTextField.delegate = self;
            _khYBTextField.returnKeyType =UIReturnKeyDone;
            _khYBTextField.keyboardType = UIKeyboardTypeNumberPad;
            _khYBTextField.textAlignment = NSTextAlignmentRight;
            [_khYBTextField addTarget:self action:@selector(khYBTextFieldClick:) forControlEvents:UIControlEventEditingChanged];
            [cell addSubview:_khYBTextField];
            _khYBTextField.font = [UIFont systemFontOfSize:15];
            if ([NSString isStringEmpty2:_postcode] == YES) {
                _khYBTextField.placeholder = @"请输入邮编";
            }else {
                _khYBTextField.text = _postcode;
            }
        }else if (indexPath.row == 7) {
            //加载家庭成员的tableView
            lineImage.hidden = YES;
            cell.subTiltleTF.hidden = YES;
            cell.subTitleLabel.hidden = YES;
            for (int i = 0; i < _khxxDataArr.count; i++) {
                NSMutableDictionary *dict = [_khxxDataArr objectAtIndex:i];
                NSString *nameString = [dict objectForKey:@"memberName"];
                NSString *documentType = [dict objectForKey:@"documentType"];
                NSString *documentTypeName = nil;
                NSString *documentNumber = [dict objectForKey:@"documentNumber"];
                
                if ([NSString isStringEmpty2:documentType] == NO) {
                    for (int i = 0; i < _zjlxList.count; i++) {
                        NSMutableDictionary *dict = [_zjlxList objectAtIndex:i];
                        if ([documentType isEqualToString:[dict objectForKey:@"dictionaryName"]]) {
                            documentTypeName = [dict objectForKey:@"dictionaryId"];
                        }
                    }
                }                
                UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, i*200, EMM_WIDTH, 200)];
                UIView *v1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, EMM_WIDTH, 50)];
                v1.backgroundColor = [UIColor colorFromHexCode:@"#FFF5E9"];
                [view addSubview:v1];
                UILabel *sLabel6 = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, 2, 30)];
                sLabel6.backgroundColor = [UIColor colorFromHexCode:@"#ff7200"];
                [view addSubview:sLabel6];
                
                UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
                button.frame = CGRectMake(EMM_WIDTH-40, 10, 30, 30);
                [button setImage:[UIImage imageNamed:@"rc_dlet"] forState:UIControlStateNormal];
                button.tag = 100 + i;
                [button addTarget:self action:@selector(dletjtcyBtnClick:) forControlEvents:UIControlEventTouchUpInside];
                [view addSubview:button];
                [cell addSubview:view];
                
                UILabel *titllName = [[UILabel alloc] initWithFrame:CGRectMake(10, 15, 100, 20)];
                titllName.font = [UIFont systemFontOfSize:15];
                titllName.text = [NSString stringWithFormat:@"家庭成员%d", i+1];
                [view addSubview:titllName];
                
                UILabel *titllName1 = [[UILabel alloc] initWithFrame:CGRectMake(10, 65, 100, 20)];
                titllName1.font = [UIFont systemFontOfSize:15];
                titllName1.text = @"客户姓名";
                titllName1.textColor = [UIColor colorFromHexCode:@"#5A5A5A"];
                [view addSubview:titllName1];
                
                UITextField *nameTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, 60, EMM_WIDTH-120, 30)];
                nameTextField.font = [UIFont systemFontOfSize:15];
                nameTextField.textAlignment = NSTextAlignmentRight;
                nameTextField.delegate = self;
                nameTextField.tag = 100 + i;
                [nameTextField addTarget:self action:@selector(khNameTextFieldClick:) forControlEvents:UIControlEventEditingChanged];
                if ([NSString isStringEmpty2:nameString] == NO) {
                    nameTextField.text = nameString;
                }else {
                    nameTextField.placeholder = @"请输入";
                }
                [view addSubview:nameTextField];
                
                UIImageView *lineImage1 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 99, EMM_WIDTH-20, 1)];
                lineImage1.backgroundColor = [UIColor colorFromHexCode:@"#e4e4e4"];
                [view addSubview:lineImage1];
                
                UILabel *titllName2 = [[UILabel alloc] initWithFrame:CGRectMake(10, 115, 100, 20)];
                titllName2.font = [UIFont systemFontOfSize:15];
                titllName2.text = @"证件类型";
                titllName2.textColor = [UIColor colorFromHexCode:@"#5A5A5A"];
                [view addSubview:titllName2];
                
                UILabel *tNameLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(110, 115, EMM_WIDTH-137, 20)];
                tNameLabel2.font = [UIFont systemFontOfSize:15];
                tNameLabel2.textAlignment = NSTextAlignmentRight;
                [view addSubview:tNameLabel2];
                
                if ([NSString isStringEmpty2:documentTypeName] == NO) {
                    tNameLabel2.text = documentTypeName;
                    tNameLabel2.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
                }else {
                    tNameLabel2.text = @"未选择";
                    tNameLabel2.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
                }
                
                UIImageView *lineImage2 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 149.5, EMM_WIDTH-20, 0.5)];
                lineImage2.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
                [view addSubview:lineImage2];
                
                UIImageView *im = [[UIImageView alloc] initWithFrame:CGRectMake(EMM_WIDTH-22, 100+(50-16)/2, 12, 16)];
                im.image = [UIImage imageNamed:@"btn_qiaoj"];
                [view addSubview:im];
                
                UIButton *jjrbtn = [UIButton buttonWithType:UIButtonTypeSystem];
                jjrbtn.frame =CGRectMake(0, 115, EMM_WIDTH, 50);
                [jjrbtn addTarget:self action:@selector(zjleiBtnClick:) forControlEvents:UIControlEventTouchUpInside];
                jjrbtn.tag = 100 + i;
                [view addSubview:jjrbtn];
                
                UILabel *titllName3 = [[UILabel alloc] initWithFrame:CGRectMake(10, 165, 100, 20)];
                titllName3.font = [UIFont systemFontOfSize:15];
                titllName3.text = @"证件号码";
                titllName3.textColor = [UIColor colorFromHexCode:@"#5A5A5A"];
                [view addSubview:titllName3];
                
                UITextField *zjhmTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, 160, EMM_WIDTH-120, 30)];
                zjhmTextField.font = [UIFont systemFontOfSize:15];
                zjhmTextField.textAlignment = NSTextAlignmentRight;
                zjhmTextField.delegate = self;
                zjhmTextField.tag = 100 + i;
                [zjhmTextField addTarget:self action:@selector(zjhmTextFieldFieldClick:) forControlEvents:UIControlEventEditingChanged];
                
                if ([NSString isStringEmpty2:documentNumber] == NO) {
                    zjhmTextField.text = documentNumber;
                    zjhmTextField.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
                }else {
                    zjhmTextField.placeholder = @"请输入";
                }
                [view addSubview:zjhmTextField];
                
                UIImageView *lineImage3 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 199, EMM_WIDTH-20, 1)];
                lineImage3.backgroundColor = [UIColor colorFromHexCode:@"#e4e4e4"];
                [view addSubview:lineImage3];
            }
        }
    }else if ([indexStr isEqualToString:@"2"]) {
#pragma mark - 分区2
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        UIImageView *lineImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 49.5, EMM_WIDTH-20, 0.5)];
        lineImage.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
        [cell addSubview:lineImage];
        if (indexPath.row == 0) {
            if (_fq2Cellrow0H == 0) {
                lineImage.hidden = YES;
                cell.titleLabel.hidden = YES;
            }else {
                if ([_floorType isEqualToString:@"0"] || _floorType == nil) {
                    cell.titleLabel.hidden = NO;
                    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                    label.textAlignment = NSTextAlignmentRight;
                    label.text = @"元";
                    label.font = [UIFont systemFontOfSize:14];
                    [cell addSubview:label];
                    
                    _zhZjMoneyTextField = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-30, 10, 200, 30)];
                    _zhZjMoneyTextField.delegate = self;
                    _zhZjMoneyTextField.returnKeyType =UIReturnKeyDone;
                    _zhZjMoneyTextField.textAlignment = NSTextAlignmentRight;
                    _zhZjMoneyTextField.keyboardType = UIKeyboardTypeDecimalPad;
                    _zhZjMoneyTextField.font = [UIFont systemFontOfSize:15];
                    [cell addSubview:_zhZjMoneyTextField];
                    if ([NSString isStringEmpty2:_discountAfterAmount] == NO) {
                        _zhZjMoneyTextField.text = [NSString stringWithFormat:@"%.2f", [_discountAfterAmount floatValue]];//_discountAfterAmount;
                    }else {
                        _zhZjMoneyTextField.placeholder = @"请输入";
                    }
                    if ([NSString isStringEmpty2:_discountAfterAmount] == NO) {
                        float dis4 = [_discountRate floatValue];//浮动值
                        float d1 = [_discountAfterAmount floatValue];//算出的比例值
                        if (d1 < dis4) {
                            _discountApproval = @"1";
                        }else {
                            _discountApproval = @"0";
                        }
                    }else {
                        _discountApproval = @"0";
                    }
                }else if([_floorType isEqualToString:@"1"]){
                    cell.titleLabel.hidden = YES;
                }
            }
        }else if (indexPath.row == 1) {
            if ([_floorType isEqualToString:@"0"] && _discountAfterAmount != nil) {
                if ([NSString isStringEmpty2:_discountAfterAmount] == NO) {
                    if ([NSString isStringEmpty2:_discountAmount] == NO) {
                        cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_discountAmount floatValue]];
                    }else {
                        cell.subtitleOneLable.text = @"元";
                    }
                }else {
                    cell.subtitleOneLable.text = @"元";
                }
            }else {
                
                UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                label.textAlignment = NSTextAlignmentRight;
                label.text = @"元";
                label.font = [UIFont systemFontOfSize:14];
                [cell addSubview:label];
                
                _zkMoneyTextField = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-30, 10, 200, 30)];
                _zkMoneyTextField.delegate = self;
                _zkMoneyTextField.returnKeyType =UIReturnKeyDone;
                _zkMoneyTextField.textAlignment = NSTextAlignmentRight;
                _zkMoneyTextField.font = [UIFont systemFontOfSize:15];
                _zkMoneyTextField.keyboardType = UIKeyboardTypeDecimalPad;
                [cell addSubview:_zkMoneyTextField];
                if ([NSString isStringEmpty2:_discountAmount] == NO) {
                    _zkMoneyTextField.text = _discountAmount;
                }else {
                    _zkMoneyTextField.placeholder = @"请输入";
                }
            }
        }else if (indexPath.row == 2) {
            if ([_floorType isEqualToString:@"0"] && _discountAfterAmount != nil) {
                //不可输入
                if ([NSString isStringEmpty2:_addDiscountRate] == NO) {
                    NSString *s = @"%";
                    cell.subtitleOneLable.text = [NSString stringWithFormat:@"%@%@",_addDiscountRate,s];
                }else {
                    cell.subtitleOneLable.text = @"%";
                }
            }else if([_floorType isEqualToString:@"1"] && _addDiscountRate != nil){
                if ([NSString isStringEmpty2:_addDiscountRate] == NO) {
                    NSString *s = @"%";
                    cell.subtitleOneLable.text = [NSString stringWithFormat:@"%@%@",_addDiscountRate,s];
                    float dis4 = [_getSubscribeDetail.discountRate floatValue] ;//浮动值
                    float d1 = [_getSubscribeDetail.addDiscountRate floatValue];//算出的比例值
                    if (d1 < dis4) {
                        _discountApproval = @"1";
                    }else {
                        
                        _discountApproval = @"0";
                    }
                }else {
                    cell.subtitleOneLable.text = @"%";
                }
            }else {
                UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-30-15, 10, 30, 30)];
                label.textAlignment = NSTextAlignmentRight;
                label.text = @"%";
                label.font = [UIFont systemFontOfSize:14];
                [cell addSubview:label];
                
                _zkBLTextField = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-30, 10, 200, 30)];
                _zkBLTextField.delegate = self;
                _zkBLTextField.returnKeyType =UIReturnKeyDone;
                _zkBLTextField.textAlignment = NSTextAlignmentRight;
                _zkBLTextField.font = [UIFont systemFontOfSize:15];
                _zkBLTextField.keyboardType = UIKeyboardTypeDecimalPad;
                [cell addSubview:_zkBLTextField];
                if ([NSString isStringEmpty2:_addDiscountRate] == NO) {
                    _zkBLTextField.text = _addDiscountRate;
                }else {
                    _zkBLTextField.placeholder = @"请输入";
                }
            }
            
        }else if (indexPath.row == 3) {
            //优惠原因选择比例方案是要显示发起审批，低价不需要显示发起审批
            lineImage.hidden = YES;
            
            if (_fq2Cellrow3H == 0) {
                cell.subTiltleTF.hidden = YES;
                cell.subTitleLabel.hidden = YES;
                cell.titleLabel.hidden = YES;
            }else {
                UIImageView *lineImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, _fq2Cellrow3H-0.5, EMM_WIDTH-20, 0.5)];
                lineImage.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
                [cell addSubview:lineImage];
                
                _xianshibd = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, EMM_WIDTH-40, 40)];
                _xianshibd.font = [UIFont systemFontOfSize:12];
                _xianshibd.numberOfLines = 0;
                NSString *s = @"%";
                
                _xianshibd.text = [NSString stringWithFormat:@"当前折扣%@%@低于比例浮动值%.0f%@，需要发起折扣审批",_addDiscountRate ,s,[_discountRate floatValue],s];
                [cell addSubview:_xianshibd];
                if ([NSString isStringEmpty2:_addDiscountRate] == NO) {
                    float dis4 = [_discountRate floatValue];//浮动值
                    float d1 = [_addDiscountRate floatValue];//算出的比例值
                    if (d1 < dis4) {
                        _xianshibd.hidden = NO;
                    }else {
                        _xianshibd.hidden = YES;
                    }
                }else {
                    _xianshibd.hidden = YES;
                }
                
                cell.titleLabel.text = [_grouparr2 objectAtIndex:indexPath.row];

                cell.titleLabel.hidden =  !_xianshibd.hidden;
                cell.subOneTF.hidden = YES;
                _tsZKTextField = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-15, 10, 200, 30)];
                _tsZKTextField.delegate = self;
                _tsZKTextField.returnKeyType =UIReturnKeyDone;
                _tsZKTextField.textAlignment = NSTextAlignmentRight;
                _tsZKTextField.font = [UIFont systemFontOfSize:15];
                _tsZKTextField.hidden = !_xianshibd.hidden;
                [cell addSubview:_tsZKTextField];
                if ([NSString isStringEmpty2:_preferentialReasons] == NO) {
                    _tsZKTextField.text = _preferentialReasons;
                }else {
                    _tsZKTextField.placeholder = @"请输入优惠原因";
                }
            }
        }else if (indexPath.row == 4) {
            _discountNoteTextField = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-15, 10, 200, 30)];
            _discountNoteTextField.delegate = self;
            _discountNoteTextField.returnKeyType =UIReturnKeyDone;
            _discountNoteTextField.textAlignment = NSTextAlignmentRight;
            _discountNoteTextField.font = [UIFont systemFontOfSize:15];
            [cell addSubview:_discountNoteTextField];
            if ([NSString isStringEmpty2:_discountNote] == NO) {
                _discountNoteTextField.text = _discountNote;
            }else {
                _discountNoteTextField.placeholder = @"请输入";
            }
        }else if (indexPath.row == 5) {
            if ([NSString isStringEmpty2:_contractPrice] == NO) {
                cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_contractPrice floatValue]];
            }else {
                cell.subtitleOneLable.text = @"元";
            }
        }else if (indexPath.row == 6) {
            cell.biaoxinL.hidden = NO;
            cell.biaoxinL.text = @"*";
            if ([NSString isStringEmpty2:_contractAmount] == NO) {
                cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_contractAmount floatValue]];
            }else {
                cell.subtitleOneLable.text = @"元";
            }
        }else if (indexPath.row == 7) {
            if (_fq2Cellrow7H == 0) {
                lineImage.hidden = YES;
            }
            if ([NSString isStringEmpty2:_realAmount] == NO) {
                cell.subtitleOneLable.text = [NSString stringWithFormat:@"%.2f元",[_realAmount floatValue]];
            }else {
                cell.titleLabel.hidden = YES;
            }
        }
    }else if ([indexStr isEqualToString:@"3"]) {
#pragma mark - 分区3
        UIImageView *lineImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 49.5, EMM_WIDTH-20, 0.5)];
        lineImage.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
        [cell addSubview:lineImage];
        
        [self displayCell:cell indexPath:indexPath];
        
    }else if ([indexStr isEqualToString:@"4"]) { // 装修款。。
        UIImageView *lineImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 49.5, EMM_WIDTH-20, 0.5)];
        lineImage.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
        [cell addSubview:lineImage];
        
        if (indexPath.row == 0) {
            cell.titleLabel.text = @"装修款";
            cell.biaoxinL.hidden = YES;
            cell.accessoryView = self.fixOff;
        }else {
            cell.accessoryView = nil;
            [self displayCell:cell indexPath:indexPath];
        }
        
    }
    else if ([indexStr isEqualToString:@"5"]) {
#pragma mark - 分区4
        UIImageView *lineImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 49.5, EMM_WIDTH-20, 0.5)];
        lineImage.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
        [cell addSubview:lineImage];
        if (indexPath.row == 0) {
            cell.biaoxinL.hidden = NO;
            cell.biaoxinL.text = @"*";
            cell.btn_qiaoJImageV.hidden = NO;
            if ([NSString isStringEmpty2:_dealCategory] == NO) {
                cell.subTitleLabel.text = _dealCategory;
                cell.subTitleLabel.textColor = [UIColor blackColor];
            }else {
                cell.subTitleLabel.text = @"未选择";
                cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
            }
        }else if (indexPath.row == 1) {
            UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(EMM_WIDTH-40, 10, 30, 30)];
            imageView.image = [UIImage imageNamed:@"rc_add"];
            [cell addSubview:imageView];
            cell.subTiltleTF.hidden = YES;
            cell.seleBtn.hidden = NO;
            [cell.seleBtn addTarget:self action:@selector(agentIdBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        }else if (indexPath.row == 2) {
            for (int i = 0; i < _jJRDataArr.count; i++) {
                NSMutableDictionary *dict = [_jJRDataArr objectAtIndex:i];
                NSString *jjr = [dict objectForKey:@"relationAgentName"];
                NSString *fybl = [dict objectForKey:@"proportionCommission"];
                UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, i*150, EMM_WIDTH, 150)];
                UIView *v1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, EMM_WIDTH, 50)];
                v1.backgroundColor = [UIColor colorFromHexCode:@"#FFF5E9"];
                [view addSubview:v1];
                UILabel *sLabel6 = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, 2, 30)];
                sLabel6.backgroundColor = [UIColor colorFromHexCode:@"#ff7200"];
                [view addSubview:sLabel6];
                
                UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
                button.frame = CGRectMake(EMM_WIDTH-40, 10, 30, 30);
                [button setImage:[UIImage imageNamed:@"rc_dlet"] forState:UIControlStateNormal];
                button.tag = 100 + i;
                [button addTarget:self action:@selector(dletJJRButtonClick:) forControlEvents:UIControlEventTouchUpInside];
                [view addSubview:button];
                [cell addSubview:view];
                
                UILabel *titllName = [[UILabel alloc] initWithFrame:CGRectMake(10, 15, 100, 20)];
                titllName.font = [UIFont systemFontOfSize:15];
                titllName.text = [NSString stringWithFormat:@"经纪人%d", i+1];
                [view addSubview:titllName];
                
                UILabel *titllName1 = [[UILabel alloc] initWithFrame:CGRectMake(10, 65, 100, 20)];
                titllName1.font = [UIFont systemFontOfSize:15];
                titllName1.text = @"经纪人";
                titllName1.textColor = [UIColor colorFromHexCode:@"#5A5A5A"];
                [view addSubview:titllName1];
                UIImageView *lineImage1 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 99, EMM_WIDTH-20, 1)];
                lineImage1.backgroundColor = [UIColor colorFromHexCode:@"#e4e4e4"];
                [view addSubview:lineImage1];
                UILabel *titllName2 = [[UILabel alloc] initWithFrame:CGRectMake(10, 115, 100, 20)];
                titllName2.font = [UIFont systemFontOfSize:15];
                titllName2.text = @"分佣比例";
                titllName2.textColor = [UIColor colorFromHexCode:@"#5A5A5A"];
                [view addSubview:titllName2];
                UIImageView *lineImage2 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 149.5, EMM_WIDTH-20, 0.5)];
                lineImage2.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
                [view addSubview:lineImage2];
                
                UIImageView *im = [[UIImageView alloc] initWithFrame:CGRectMake(EMM_WIDTH-22, 50+(50-16)/2, 12, 16)];
                im.image = [UIImage imageNamed:@"btn_qiaoj"];
                [view addSubview:im];
                
                UIButton *jjrbtn = [UIButton buttonWithType:UIButtonTypeSystem];
                jjrbtn.frame =CGRectMake(0, 65, EMM_WIDTH, 50);
                [jjrbtn addTarget:self action:@selector(jjrBtnClick:) forControlEvents:UIControlEventTouchUpInside];
                jjrbtn.tag = 100 + i;
                [view addSubview:jjrbtn];
                //
                UILabel *labelJJR = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-227, 65, 200, 20)];
                labelJJR.font = [UIFont systemFontOfSize:15];
                labelJJR.textAlignment = NSTextAlignmentRight;
                [view addSubview:labelJJR];
                if ([NSString isStringEmpty2:jjr] == NO) {
                    labelJJR.text = jjr;
                    labelJJR.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
                }else {
                    labelJJR.text = @"请选择";
                    labelJJR.textColor = [UIColor colorFromHexCode:@"#CCCCCC"];
                }
                
                UILabel *lbfh = [[UILabel alloc] initWithFrame:CGRectMake(EMM_WIDTH-25, 115, 15, 20)];
                lbfh.font = [UIFont systemFontOfSize:15];
                lbfh.text = @"%";
                [view addSubview:lbfh];
                
                UITextField *fyblTextField = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-230, 110, 200, 30)];
                fyblTextField.font = [UIFont systemFontOfSize:15];
                fyblTextField.textAlignment = NSTextAlignmentRight;
                fyblTextField.keyboardType = UIKeyboardTypeDecimalPad;
                fyblTextField.delegate = self;
                if ([NSString isStringEmpty2:fybl] == NO && ![fybl isEqualToString:@""]) {
                    NSLog(@"--- >> %@",[NSString getMoney2:[fybl floatValue]]);
                    fyblTextField.text = [NSString stringWithFormat:@"%@",[NSString getMoney2:[fybl floatValue]]];
                    fyblTextField.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
                }else {
                    fyblTextField.placeholder = @"请输入";
                }
                [fyblTextField addTarget:self action:@selector(fyblTextClick:) forControlEvents:UIControlEventEditingChanged];
                fyblTextField.tag = 100 + i;
                [view addSubview:fyblTextField];
            }
        }
    }else if ([indexStr isEqualToString:@"6"]) {
#pragma mark - 分区5
        UIImageView *lineImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 49.5, EMM_WIDTH-20, 0.5)];
        lineImage.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
        [cell addSubview:lineImage];
        if (indexPath.row == 0) {
            if (_fq5Cellrow0H == 0) {
                cell.titleLabel.hidden = YES;
            }else {
                cell.biaoxinL.hidden = NO;
                cell.biaoxinL.text = @"*";
                cell.btn_qiaoJImageV.hidden = NO;
                
                UIButton *bu = [UIButton buttonWithType:UIButtonTypeSystem];
                bu.frame = CGRectMake(EMM_WIDTH-30, 10, 30, 30);
                [bu addTarget:self action:@selector(butjrClick:) forControlEvents:UIControlEventTouchUpInside];
                [cell addSubview:bu];
                
                _referenceNameTextField = [[UITextField alloc] initWithFrame:CGRectMake(EMM_WIDTH-200-28, 10, 200, 30)];
                _referenceNameTextField.delegate = self;
                _referenceNameTextField.returnKeyType =UIReturnKeyDone;
                _referenceNameTextField.textAlignment = NSTextAlignmentRight;
                _referenceNameTextField.tag = indexPath.section+100;
                [cell addSubview:_referenceNameTextField];
                _referenceNameTextField.font = [UIFont systemFontOfSize:15];
                if ([NSString isStringEmpty2:_referenceName] == YES) {
                    _referenceNameTextField.placeholder = @"请输入";
                }else {
                    _referenceNameTextField.text = _referenceName;
                }
            }
        }else if (indexPath.row == 1) {
            cell.btn_qiaoJImageV.hidden = NO;
            if ([NSString isStringEmpty2:_signedDate] == NO) {
                cell.subTitleLabel.text = _signedDate;
                cell.subTitleLabel.textColor = [UIColor blackColor];
            }else {
                cell.subTitleLabel.text = @"未选择";
                cell.subTitleLabel.textColor = [UIColor colorFromHexCode:@"#C7C7CD"];
            }
            
        }else if (indexPath.row == 2) {
            cell.seleBtn.hidden = YES;
            _remarkTV= [[UITextView alloc] initWithFrame:CGRectMake(60 + 30, 5, EMM_WIDTH-100, _remarkTVHeight + 6)];
            _remarkTV.delegate = self;
            _remarkTV.returnKeyType =UIReturnKeyDone;
            _remarkTV.textAlignment = NSTextAlignmentRight;
            [cell addSubview:_remarkTV];
            _remarkTV.font = [UIFont systemFontOfSize:15];
            if ([NSString isStringEmpty2:_remark] == NO) {
                _remarkTV.text = _remark;
                _remarkTV.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
            }else {
                _remarkTV.text = @"备注";
                _remarkTV.textColor = [UIColor colorFromHexCode:@"#CCCCCC"];
            }
            lineImage.hidden = YES;
            UIImageView *lineImage1 = [[UIImageView alloc] init];
            lineImage1.frame = CGRectMake(10, _remarkTVHeight + 16 - 0.5, EMM_WIDTH - 20, 0.5);
            lineImage1.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
            [cell addSubview:lineImage1];
        }
    }else if ([indexStr isEqualToString:@"7"]) {
#pragma mark - 分区6
        cell.titleLabel.hidden = YES;
        int columnCount=3;
        //没个格子的宽度和高度
        CGFloat appW=100;
        CGFloat appH=100;
        //计算间隙
        CGFloat appMargin=(EMM_WIDTH-columnCount*appW)/(columnCount+1);
        for (int i=0; i<_picArray.count; i++) {
            UIView *vi=[[UIView alloc] init];
            vi.backgroundColor=[UIColor whiteColor];
        
            //计算列号和行号
            int colX=i%columnCount;
            int rowY=i/columnCount;
            //计算坐标
            CGFloat appX=appMargin+colX*(appW+appMargin);
            CGFloat appY=rowY*(appH+appMargin);
            NSInteger gdH = 0;
            if (i <= 2) {
                gdH = 10;
            }else {
                gdH = 0;
            }
            vi.frame=CGRectMake(appX, appY+gdH, appW, appH);
            [cell addSubview:vi];
            
            UIImageView *im = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 90, 90)];
            [vi addSubview:im];
            NSMutableDictionary *dict = [_picArray objectAtIndex:i];
            NSString *type = [dict objectForKey:@"type"];
            
            if ([type isEqualToString:@"type"]) {
                UIButton *buton = [UIButton buttonWithType:UIButtonTypeSystem];
                buton.frame = CGRectMake(0, 0, 100, 100);
                buton.backgroundColor = [UIColor whiteColor];
                [buton addTarget:self action:@selector(butonClick:) forControlEvents:UIControlEventTouchUpInside];
                [vi addSubview:buton];
                
                UIImageView *xuxianImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
                xuxianImageV.image = [UIImage imageNamed:@"xuxian"];
                [vi addSubview:xuxianImageV];
                
                UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(40, 25, 20, 20)];
                imageView.image = [UIImage imageNamed:@"btn_more"];
                [vi addSubview:imageView];
                UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 55, 100, 20)];
                label.text = @"添加附件";
                label.textAlignment = NSTextAlignmentCenter;
                label.font = [UIFont systemFontOfSize:15];
                [vi addSubview:label];
            } else {
                UIButton *seebuton = [UIButton buttonWithType:UIButtonTypeSystem];
                seebuton.frame = CGRectMake(0, 0, 100, 100);
                [seebuton addTarget:self action:@selector(seeButtonClick:) forControlEvents:UIControlEventTouchUpInside];
                seebuton.tag = i;
                [vi addSubview:seebuton];
                
                UIImageView *xuxianImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
                xuxianImageV.image = [UIImage imageNamed:@"xuxian"];
                [vi addSubview:xuxianImageV];
                
                UIImageView *deleIm = [[UIImageView alloc] initWithFrame:CGRectMake(75, 5, 20, 20)];
                deleIm.image = [UIImage imageNamed:@"rc_dlet"];
                [vi addSubview:deleIm];
                
                UIButton *buton = [UIButton buttonWithType:UIButtonTypeSystem];
                buton.frame = CGRectMake(70, 0, 30, 30);
                [buton addTarget:self action:@selector(deleteButonClick:) forControlEvents:UIControlEventTouchUpInside];
                buton.tag = i;
                [vi addSubview:buton];
                
                if ([type isEqualToString:@"1"]) {
                    VGReturnGoodsPicDTO *temp = [[VGReturnGoodsPicDTO alloc] init];
                    temp.picImage = [dict objectForKey:@"image"];
                    im.image = temp.picImage;
                }else if([type isEqualToString:@"2"]){
                    [im sd_setImageWithURL:[dict objectForKey:@"image"] placeholderImage:nil];
                }
            }            
        }
        
    }
    
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        if (indexPath.row == 1) {
            if(self.houseDetailTo) return;
            if ([self.konString isEqualToString:@"0"]) {
                HousingViewController *hvn = [[HousingViewController alloc] init];
                
                hvn.housingNewBlock = ^(NSMutableArray *roomArr,NSString *huoing) {
                    _roomList = [roomArr objectAtIndex:0];
                    _qyRoomName = huoing;
                    _qyRoomId = _roomList.roomId;
                    _calculateArea = _roomList.calculateArea;
                    _discountPrice = _roomList.discountPrice;
                    _discountTotalPrice = _roomList.discountTotalPrice;
                    _discountRate = _roomList.discountRate;
                    _discountAmount1 = [NSString getMoney2:[_roomList.discountAmount floatValue]];
                    _floorType = _roomList.floorType;
                    if ([_floorType isEqualToString:@"0"]) {
                        _fq2Cellrow0H = 50;
                        _fq2Cellrow3H = 0;
                        _addDiscountRate = @"";//[NSString getMoney2:[str5 floatValue]*100];
                        _discountAmount = @"";
                        float dis2 = [_discountTotalPrice floatValue];
                        _contractAmount = [NSString getVal:2 val:dis2];
                        float dis3 = [_calculateArea floatValue];
//                        float d2 = (dis2-dis1);
//                        float d3 = (d2/dis3);
                        float price = [_contractAmount floatValue];
                        _contractPrice = [NSString getVal:2 val:price/dis3];
                    }else {
                        _discountAmount = _discountAmount1;
                        
                        if ([NSString isStringEmpty2:_discountTotalPrice] == NO) {
                            float dis1 = [_discountAmount floatValue];
                            float dis2 = [_discountTotalPrice floatValue];
                            float dis3 = [_calculateArea floatValue];
                            float d2 = (dis2-dis1);
                            float d3 = (d2/dis3);
                            _xianshibd.hidden = YES;
                            _fq2Cellrow0H = 0;
                            _fq2Cellrow3H = 0;
//                            _discountRate = [NSString getMoney2:[_roomList.discountRate floatValue]];
                            _addDiscountRate = _discountRate;//[NSString getMoney2:[_roomList.discountRate floatValue]];
                            _contractPrice = [NSString getVal:2 val:d3];
                            _contractAmount = [NSString getVal:2 val:d2];

                        }
                    }
                    [_tableView reloadData];
                };
                [self.navigationController pushViewController:hvn animated:YES];
            }
        }
    }else if (indexPath.section == 1) {
        if (indexPath.row == 2) {
//            NSArray *arr = [NSArray arrayWithObjects:@"身份证",@"护照",@"营业执照",
//                            @"户口薄",@"军官证", @"临时身份证",@"港澳台同胞来往通行证",
//                            @"边民出入境通行证", @"外国人永久居留证",@"警官证", @"士兵证",@"其他", nil];
            if (_zjlxList.count == 0) {
                [self showToast:@"暂无可选项"];
                return;
            }
            NSMutableArray *arr = [[NSMutableArray alloc] init];
            for (int i = 0; i < _zjlxList.count; i++) {
                NSMutableDictionary *dict = [_zjlxList objectAtIndex:i];
                [arr addObject:[dict objectForKey:@"dictionaryName"]];
            }
            
            ShowMenuView *menuView = [[ShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) title:@"证件号类型" titleNmae:@"请选择" numLits:nil items:arr];
            menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
            [[UIApplication sharedApplication].keyWindow addSubview:menuView];
            __block ShowMenuView *weakMenuView = menuView;
            __block AddNewSignViewController *blockSelf = self;
            [menuView setTouchBlock:^(NSString *indet, NSString *numberString) {                
                if ([NSString isStringEmpty2:indet] == NO) {
                    _documentName = indet;
                    for (int i = 0; i < _zjlxList.count; i++) {
                        NSMutableDictionary *dict = [_zjlxList objectAtIndex:i];
                        if ([_documentName isEqualToString:[dict objectForKey:@"dictionaryName"]]) {
                            _documentType = [dict objectForKey:@"dictionaryId"];
                        }
                    }
                }
                
                [weakMenuView removeFromSuperview];
                [blockSelf.tableView reloadData];
            }];
        }
    }else if (indexPath.section == 2) {
        
    }else if (indexPath.section == 3) {
        [self didSelectedCellWithIndexPath:indexPath];

    }else if (indexPath.section == 4) { // 装修款
        [self didSelectedCellWithIndexPath:indexPath];
        
    }
    else if (indexPath.section == 5) {
        if (indexPath.row == 0) {
            //1、推荐成交；2、单独成交；3、共同成交
            NSArray *arr = [NSArray arrayWithObjects:
                            @"推荐成交",@"单独成交",@"共同成交", nil];
            ShowMenuView *menuView = [[ShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) title:@"选项" titleNmae:@"请选择成交类别" numLits:nil items:arr];
            menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
            [[UIApplication sharedApplication].keyWindow addSubview:menuView];
            __block ShowMenuView *weakMenuView = menuView;
            __block AddNewSignViewController *blockSelf = self;
            [menuView setTouchBlock:^(NSString *indet, NSString *numberId) {
                if ([NSString isStringEmpty2:indet] == NO) {
                    [_jJRDataArr removeAllObjects];
                    _dealCategory = indet;
                    _dealCategoryId = numberId;
                    if ([_dealCategory isEqualToString:@"推荐成交"]) {
                        _fq5Cellrow0H = 50;
                        _fq5Cellrow1H = 50;
                    }else {
                        _fq5Cellrow0H = 0;
                        _fq5Cellrow1H = 0;
                    }

                    if ([NSString isStringEmpty2:indet] == NO) {
                        NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
                        NSString *userName = [userdf objectForKey:@"userName"];
                        NSString *userId = [userdf objectForKey:@"userNameId"];
                        NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
                        [dict setObject:userId forKey:@"relationAgentId"];
                        [dict setObject:userName forKey:@"relationAgentName"];
                        [dict setObject:@"100.00" forKey:@"proportionCommission"];
                        [_jJRDataArr addObject:dict];
                    }
                }
                [weakMenuView removeFromSuperview];
                [blockSelf.tableView reloadData];
            }];
        }
    }else if (indexPath.section == 6) {
        if (indexPath.row == 2) {
            TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
            menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
            [[UIApplication sharedApplication].keyWindow addSubview:menuView];
            __block TimerShowMenuView *weakMenuView = menuView;
            __block AddNewSignViewController *blockSelf = self;
            [menuView setTimerBlock:^(NSString *indet) {
                if ([NSString isStringEmpty2:indet] == NO) {
                    _signedDate = indet;
                }
                [weakMenuView removeFromSuperview];
                [blockSelf.tableView reloadData];
            }];
        }
    }else if (indexPath.section == 7) {
        
    }
}
#pragma mark - 点击cell 处理事件
- (void)didSelectedCellWithIndexPath:(NSIndexPath *)indexP {
    NSInteger selectedIdx = indexP.row;
    if(indexP.section == 4) {
        selectedIdx -= 2;
    }
    NSString *methodType = indexP.section == 4 ? self.fixPaymentType : self.paymentMethod;
    
        if (selectedIdx == 0) {
            NSArray *arr = [NSArray arrayWithObjects:
                            @"一次性付款",@"分期付款",@"商业按揭",
                            @"公积金按揭", @"组合贷款", nil];
            if(indexP.section == 4){
                arr = @[ @"一次性付款",@"分期付款",@"商业按揭"];
            }
            
            ShowMenuView *menuView = [[ShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) title:@"选项" titleNmae:@"请选择付款方式" numLits:nil items:arr];
            menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
            [[UIApplication sharedApplication].keyWindow addSubview:menuView];
            __block ShowMenuView *weakMenuView = menuView;
            __block AddNewSignViewController *blockSelf = self;
            [menuView setTouchBlock:^(NSString *indet, NSString *numberId) {
                if ([NSString isStringEmpty2:indet] == NO) {

                    if (indexP.section == 3) {
                        _paymentMethod = indet;
                        _paymentMethodId = numberId;

                        if ([indet isEqualToString:@"一次性付款"]) {
                            _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",
                                          @"应收金额",@"已收金额",@"未收金额",@"应收日期",nil];
                        }else if ([indet isEqualToString:@"分期付款"]) {
                            _grouparr3 = [[NSMutableArray alloc]initWithObjects: @"付款方式",
                                          @"一期款",@"已收金额",@"未收金额",@"一期应收日期",
                                          @"二期款",@"已收金额",@"未收金额",@"二期应收日期",
                                          @"三期款",@"已收金额",@"未收金额",@"三期应收日期",
                                          @"四期款",@"已收金额",@"未收金额",@"四期应收日期",
                                          @"五期款",@"已收金额",@"未收金额",@"五期应收日期",nil];
                        }else if ([indet isEqualToString:@"商业按揭"]) {
                            _grouparr3 = [[NSMutableArray alloc]initWithObjects: @"付款方式",
                                          @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
                                          @"商业按揭款",@"已收金额",@"未收金额",@"商业按揭应收日期", nil];
                        }else if ([indet isEqualToString:@"公积金按揭"]) {
                            _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",
                                          @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
                                          @"公积金按揭款",@"已收金额",@"未收金额",@"公积金按揭应收日期", nil];
                        }else if ([indet isEqualToString:@"组合贷款"]) {
                            _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",
                                          @"首付款",@"已收金额",@"未收金额",@"首付应收日期",
                                          @"商业按揭款",@"已收金额",@"未收金额",@"商业按揭应收日期",
                                          @"公积金按揭款",@"已收金额",@"未收金额",@"公积金按揭应收日期", nil];
                        }else {
                            _grouparr3 = [[NSMutableArray alloc]initWithObjects:@"付款方式",nil];
                        }
                        [_dictionary setValue:_grouparr3 forKey:@"3"];
                    }else {
                        self.fixPaymentType = indet;
                        self.fixPaymentId = numberId;
                        
                        [self creatDataWithFixHouseAmount];
                    }
                }
                [weakMenuView removeFromSuperview];
                [blockSelf.tableView reloadData];
            }];
            
        }else {
            if ([NSString isStringEmpty2:methodType] == NO) {
                if ([methodType isEqualToString:@"一次性付款"]) {
                    if (selectedIdx == 4) {
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    _receivableDate = indet;
                                }else {
                                    self.fixReceivableDate = indet;
                                }
                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                    }
                    
                }else if ([methodType isEqualToString:@"分期付款"]) {
                    
                    if (selectedIdx == 4) {//1
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                        
                                    _receivableDate1 = indet;
                                }else {
                                    self.fixReceivableData1 = indet;
                                }
                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                    }else if (selectedIdx == 8) {//2
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate2 = indet;
                                }else {
                                    self.fixReceivableData2 = indet;
                                }
                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                    }else if (selectedIdx == 12) {//3
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate3 = indet;
                                }else {
                                    self.fixReceivableData3 = indet;
                                }
                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                        
                    }else if (selectedIdx == 16) {//4
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate4 = indet;
                                }else {
                                    self.fixReceivableData4 = indet;
                                }
                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                    }else if (selectedIdx == 20) {//5
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate5 = indet;
                                }else {
                                    self.fixReceivableData5 = indet;
                                }
                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                    }
                    
                }else if ([methodType isEqualToString:@"商业按揭"]) {
                    if (selectedIdx == 4) {//11
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate9 = indet;
                                }else {
                                    self.fixReceivableData9 = indet;
                                }
                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                    }else if (selectedIdx == 8) {//12
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate10 = indet;
                                }else {
                                    self.fixReceivableData10 = indet;
                                }
                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                    }
                    
                }else if ([methodType isEqualToString:@"公积金按揭"]) {
                    if (selectedIdx == 4) {//11
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate11 = indet;
                                }else {
                                    self.fixReceivableData11 = indet;
                                }

                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                    }else if (selectedIdx == 8) {//12
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate12 = indet;
                                }else {
                                    self.fixReceivableData12 = indet;
                                }

                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                    }
                }else if ([methodType isEqualToString:@"组合贷款"]) {
                    if (selectedIdx == 4) {//6
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate6 = indet;
                                }else {
                                    self.fixReceivableData6 = indet;
                                }

                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                    }else if (selectedIdx == 8) {//7
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate7 = indet;
                                }else {
                                    self.fixReceivableData7 = indet;
                                }
                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                        
                    }else if (selectedIdx == 12) {//8
                        TimerShowMenuView *menuView = [[TimerShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
                        menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                        [[UIApplication sharedApplication].keyWindow addSubview:menuView];
                        __block TimerShowMenuView *weakMenuView = menuView;
                        __block AddNewSignViewController *blockSelf = self;
                        [menuView setTimerBlock:^(NSString *indet) {
                            if ([NSString isStringEmpty2:indet] == NO) {
                                if (indexP.section == 3) {
                                    
                                    _receivableDate8 = indet;
                                }else {
                                    self.fixReceivableData8 = indet;
                                }
                            }
                            [weakMenuView removeFromSuperview];
                            [blockSelf.one3TabView reloadData];
                            [blockSelf.tableView reloadData];
                        }];
                    }
                }
            }
            [_tableView reloadData];
        }
}



#pragma mark - 删除上传图片
- (void)deleteButonClick:(UIButton *)btn {
    NSMutableDictionary *dictPic = [_picArray objectAtIndex:btn.tag];
    NSString *type = [dictPic objectForKey:@"type"];
    if ([type isEqualToString:@"2"]) {
        NSString *url = [dictPic objectForKey:@"image"];
        NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
        [dict setObject:url forKey:@"signedUrl"];
        NSString *str = @"1";
        [dict setObject:str forKey:@"headType"];
        [_imageList addObject:dict];
    }
    [_picArray removeObjectAtIndex:btn.tag];
    [_tableView reloadData];
}

#pragma mark - 查看大图
- (void)seeButtonClick:(UIButton *)btn {
    if (_picArray.count > 0) {
        MHPhotoBrowserController *vc = [MHPhotoBrowserController new];
        NSMutableArray * bigImgArray = [NSMutableArray new];
        for (int i = 0; i < _picArray.count; i++) {
            NSMutableDictionary *dict = [_picArray objectAtIndex:i];
            NSString *type = [dict objectForKey:@"type"];
            if ([type isEqualToString:@"1"]) {
                [bigImgArray addObject:[MHPhotoModel photoWithImage:[dict objectForKey:@"image"]]];
            }else if([type isEqualToString:@"2"]){
                [bigImgArray addObject:[MHPhotoModel photoWithURL:[NSURL URLWithString:[dict objectForKey:@"image"]]]];
            }
        }
        vc.currentImgIndex = (int)btn.tag;
        vc.displayTopPage = YES;
        vc.displayDeleteBtn = YES;
        vc.imgArray = bigImgArray;
        //        vc.isShouDel = 1;
        vc.displayDeleteBtn = NO;
        [self presentViewController:vc animated:YES completion:nil];
    }else {
        [self showToast:@"暂无图片预览"];
    }
}

#pragma mark - 分区选择中
-(void)doButton:(UIButton *)sender {
    NSString *string = [NSString stringWithFormat:@"%ld",sender.tag-100];
    //数组selectedArr里面存的数据和表头想对应，方便以后做比较
    if ([_selectedArr containsObject:string]) {
        if ([string isEqualToString:@"1"]) {
            [_selectedArr removeObject:string];
            [_selectedArr removeObject:@"2"];
            [_selectedArr removeObject:@"3"];
            [_selectedArr removeObject:@"4"];
            [_selectedArr removeObject:@"5"];

        }else {
            [_selectedArr removeObject:string];

        }
    }else {
        if ([string isEqualToString:@"1"]) {
            [_selectedArr addObject:string];
            [_selectedArr addObject:@"2"];
            [_selectedArr addObject:@"3"];
            [_selectedArr addObject:@"4"];
            [_selectedArr addObject:@"5"];

        }else {
            [_selectedArr addObject:string];
        }    }
    [_tableView reloadData];
}

#pragma mark - 客户家庭成员 所有调用的方法
- (void)newKHCYBtnClick:(UIButton *)btn {
    
    NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
    [dict setObject:@"" forKey:@"memberName"];
    [dict setObject:@"" forKey:@"documentType"];
    [dict setObject:@"" forKey:@"documentNumber"];
    [_khxxDataArr addObject:dict];
    [_tableView reloadData];
}

//- 认购删除家庭成员
- (void)dletjtcyBtnClick:(UIButton *)btn {
    [_khxxDataArr removeObjectAtIndex:btn.tag - 100];
    [_tableView reloadData];
}

//- 选择家庭成员证件类型
- (void)zjleiBtnClick:(UIButton *)btn {
//    NSArray *arr = [NSArray arrayWithObjects:@"身份证",@"护照",@"营业执照",
//                    @"户口薄",@"军官证", @"临时身份证",@"港澳台同胞来往通行证",
//                    @"边民出入境通行证", @"外国人永久居留证",@"警官证", @"士兵证",@"其他", nil];
    if (_zjlxList.count == 0) {
        [self showToast:@"暂无可选项"];
        return;
    }
    NSMutableArray *arr = [[NSMutableArray alloc] init];
    for (int i = 0; i < _zjlxList.count; i++) {
        NSMutableDictionary *dict = [_zjlxList objectAtIndex:i];
        [arr addObject:[dict objectForKey:@"dictionaryName"]];
    }
    
    ShowMenuView *menuView = [[ShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) title:@"证件号类型" titleNmae:@"请选择" numLits:nil items:arr];
    menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    [[UIApplication sharedApplication].keyWindow addSubview:menuView];
    __block ShowMenuView *weakMenuView = menuView;
    __block AddNewSignViewController *blockSelf = self;
    [menuView setTouchBlock:^(NSString *indet, NSString *numberString) {
        NSLog(@"%@",indet);
        if ([NSString isStringEmpty2:indet] == NO) {
            NSString *documentId = nil;
            for (int i = 0; i < _zjlxList.count; i++) {
                NSMutableDictionary *newDict = [_zjlxList objectAtIndex:i];
                if ([indet isEqualToString:[newDict objectForKey:@"dictionaryName"]]) {
                    documentId = [newDict objectForKey:@"dictionaryId"];
                }
            }
            NSMutableDictionary *dict = [_khxxDataArr objectAtIndex:btn.tag - 100];
            [dict setObject:documentId forKey:@"documentType"];
        }
        [weakMenuView removeFromSuperview];
        [blockSelf.tableView reloadData];
    }];
}

//输入客户姓名
- (void)khNameTextFieldClick:(UITextField *)textField {
    NSMutableDictionary *dict = [_khxxDataArr objectAtIndex:textField.tag - 100];
    if ([NSString isStringEmpty2:textField.text] == NO) {
        [dict setObject:textField.text forKey:@"memberName"];
    }else {
        [dict setObject:@"" forKey:@"memberName"];
    }
}

//输入证件号码
- (void)zjhmTextFieldFieldClick:(UITextField *)textField {
    NSMutableDictionary *dict = [_khxxDataArr objectAtIndex:textField.tag - 100];
    if ([NSString isStringEmpty2:textField.text] == NO) {
        [dict setObject:textField.text forKey:@"documentNumber"];
    }else {
        [dict setObject:@"" forKey:@"documentNumber"];
    }
}

#pragma mark - 新增经纪人
- (void)agentIdBtnClick:(UIButton *)btn {
    if ([_dealCategoryId isEqualToString:@"1"] || [_dealCategoryId isEqualToString:@"2"]) {
        if (_jJRDataArr.count >= 1) {
            [self showToast:@"最多只能添加一位经纪人"];
            return;
        }
        NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
        NSString *userName = [userdf objectForKey:@"userName"];
        NSString *userId = [userdf objectForKey:@"userNameId"];
        NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
        [dict setObject:userId forKey:@"relationAgentId"];
        [dict setObject:userName forKey:@"relationAgentName"];
        [dict setObject:@"100.00" forKey:@"proportionCommission"];
        [_jJRDataArr addObject:dict];
        
    }else if ([_dealCategoryId isEqualToString:@"3"]) {
        if (_jJRDataArr.count >= 3) {
            [self showToast:@"共同成交最多添加三个经纪人"];
            return;
        }
        NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
        [dict setObject:@"" forKey:@"relationAgentId"];
        [dict setObject:@"" forKey:@"relationAgentName"];
        [dict setObject:@"" forKey:@"proportionCommission"];
        [_jJRDataArr addObject:dict];
        if (_jJRDataArr.count == 1) {
            NSMutableDictionary *dict1 = [_jJRDataArr objectAtIndex:0];
            NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
            NSString *userName = [userdf objectForKey:@"userName"];
            NSString *userId = [userdf objectForKey:@"userNameId"];
            [dict1 setObject:userId forKey:@"relationAgentId"];
            [dict1 setObject:userName forKey:@"relationAgentName"];
            [dict1 setObject:@"100.00" forKey:@"proportionCommission"];
        }
    }else {
        [self showToast:@"请先选择成交类别"];
    }
    [_tableView reloadData];
}

//删除经纪人
- (void)dletJJRButtonClick:(UIButton *)btn {
    [_jJRDataArr removeObjectAtIndex:btn.tag - 100];
    [_tableView reloadData];
}

//选择经纪人
- (void)jjrBtnClick:(UIButton *)btn {
    ShowMenuView *menuView = [[ShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) title:@"" titleNmae:@"请选经纪人" numLits:nil items:_zyDataArr];
    menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    [[UIApplication sharedApplication].keyWindow addSubview:menuView];
    __block ShowMenuView *weakMenuView = menuView;
    __block AddNewSignViewController *blockSelf = self;
    [menuView setTouchBlock:^(NSString *indet, NSString *number) {
        if ([NSString isStringEmpty2:indet] == NO) {
            NSString *sId;
            NSString *sName;
            if (indet.length > 0) {
                for (int i = 0; i < _zyData.count; i++) {
                    ConsultantList *list = [_zyData objectAtIndex:i];
                    if ([indet isEqualToString:list.consultantUserName]) {
                        sId = list.consultantUserId;
                        sName = list.consultantUserName;
                    }
                }
            }
            if (_jJRDataArr.count > 0) {
                NSMutableDictionary *dict = [_jJRDataArr objectAtIndex:btn.tag - 100];
                if ([NSString isStringEmpty2:sId] == NO) {
                    [dict setObject:sId forKey:@"relationAgentId"];
                    
                }else {
                    [dict setObject:@"" forKey:@"relationAgentId"];
                }
                
                if ([NSString isStringEmpty2:sName] == NO) {
                    [dict setObject:sName forKey:@"relationAgentName"];
                    
                }else {
                    [dict setObject:@"" forKey:@"relationAgentName"];
                }
            }   
        }
        [weakMenuView removeFromSuperview];
        [blockSelf.tableView reloadData];
    }];
}

- (void)fyblTextClick:(UITextField *)textField {
    NSMutableDictionary *dict = [_jJRDataArr objectAtIndex:textField.tag - 100];
    if ([NSString isStringEmpty2:textField.text] == NO) {
        [dict setObject:textField.text forKey:@"proportionCommission"];
    }else {
        [dict setObject:@"" forKey:@"proportionCommission"];
    }
}
#pragma mark - 推荐人选择
- (void)butjrClick:(UIButton *)btn {
    if (_recommendCustomerNameList.count == 0) {
        [self showToast:@"暂无推荐人可选"];
        return;
    }
    
    ShowMenuView *menuView = [[ShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) title:@"" titleNmae:@"请选推荐人" numLits:nil items:_recommendCustomerNameList];
    menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    [[UIApplication sharedApplication].keyWindow addSubview:menuView];
    __block ShowMenuView *weakMenuView = menuView;
    __block AddNewSignViewController *blockSelf = self;
    [menuView setTouchBlock:^(NSString *indet, NSString *number) {
        if ([NSString isStringEmpty2:indet] == NO) {
            if (indet.length > 0) {
                for (int i = 0; i < _recommendCustomerList.count; i++) {
                    RecommendCustomerList *list = [_recommendCustomerList objectAtIndex:i];
                    if ([indet isEqualToString:list.customerName]) {
                        _referenceId = list.customerId;
                        _referenceName = list.customerName;
                    }
                }
            }
        }
        [weakMenuView removeFromSuperview];
        [blockSelf.tableView reloadData];
    }];
}

#pragma mark - 邮编输入框
-(void)khYBTextFieldClick:(UITextField *)textField {
    if (textField.text.length != 0) {
        if (textField.text.length >6) {
            [self showToast:@"邮编不超过六位"];
            [_tableView reloadData];
        }else {
            _postcode = textField.text;
        }
    }
}

- (void)calculateSellAmount {
    /*
     1、折后总价：手动输入
     2、折扣金额=折前总价-折后总价
     3、折后比例=折后总价/折前总价
     4、合同金额：①折后总价为空时，等于折前总价；②折后总价不为空，等于折后总价
     */
    if ([NSString isStringEmpty2:_discountAfterAmount] == NO) {
        if (_discountAfterAmount.length > 0) {
            float dis = [_discountTotalPrice floatValue];//折前总价
            float dis2 = [_discountAfterAmount floatValue];
            float zkJE = dis - dis2;
            float zkBL = dis2/dis;
            float qyDj = [_calculateArea floatValue];
            float djJE = dis2/qyDj;
            _contractPrice = [NSString getVal:2 val:djJE];
            
            _discountAmount = [NSString getMoney2:zkJE];
            _addDiscountRate = [NSString getMoney2:zkBL*100];
            _contractAmount = [NSString getMoney2:[_discountAfterAmount floatValue]];
            _contractAmount = [NSString getVal:2 val:[_discountAfterAmount floatValue]];
            
        }else {
            
        }
    }else {
        _discountAfterAmount = nil;
        _discountAmount = nil;
        _addDiscountRate = nil;
        if ([NSString isStringEmpty2:_discountTotalPrice] == NO) {
            float dis3 = [_calculateArea floatValue];
            _contractAmount = [NSString getVal:2 val:[_discountTotalPrice floatValue]];//合同金额
            float price = [_contractAmount floatValue];
            _contractPrice = [NSString getVal:2 val:price/dis3];
            
        }else {
            _contractAmount = nil;//合同金额
            _contractPrice = nil;
        }
    }
}

#pragma mark - 获取输入的值
-(void)textFieldDidEndEditing:(UITextField *)textField {
     if (textField == _receivableTextFile) {//应收金额
         if (textField.tag == 3) {
             _receivable = textField.text;
             if (_receivable.length > 0) {
                 _yicxWSFKMony = [NSString getMoney2:[_receivable floatValue] - [_yicxYSFKMony floatValue]];
             }
             
         }else {
             self.fixReceivable = textField.text;
             self.fixYicxWSFKMony = [NSString getMoney2:[self.fixReceivable floatValue] - [self.fixYicxYSFKMony floatValue]];
             
         }

    }else if (textField == _receivable1TextFile) {//应收金额1
        if (textField.tag == 3) {
            _receivable1 = textField.text;
            _fqYQWSMony = [NSString getMoney2:[_receivable1 floatValue] - [_fqYQYSMony floatValue]];
            
        }else {
            self.fixReceivable1 = textField.text;
              self.fixFqYQWSMony = [NSString getMoney2:[self.fixReceivable1 floatValue] - [self.fixFqYQWSMony floatValue]];
        }

    }else if (textField == _receivable2TextFile) {//应收金额2
        if (textField.tag == 3) {
            _receivable2 = textField.text;
            _fqEQWSMony = [NSString getMoney2:[_receivable2 floatValue] - [_fqEQYSMony floatValue]];
            
        }else {
            self.fixReceivable2 = textField.text;
             self.fixFqEQWSMony = [NSString getMoney2:[self.fixReceivable2 floatValue] - [self.fixFqEQYSMony floatValue]];
        }

        
    }else if (textField == _receivable3TextFile) {//应收金额3
        if (textField.tag == 3) {
            _receivable3 = textField.text;
            _fqSQWSMony = [NSString getMoney2:[_receivable3 floatValue] - [_fqSQYSMony floatValue]];
        }else {
            self.fixReceivable3 = textField.text;
        }

    }else if (textField == _receivable4TextFile) {//应收金额4
        if (textField.tag == 3) {
            _receivable4 = textField.text;
            _fqSIQWSMony = [NSString getMoney2:[_receivable4 floatValue] - [_fqSIQYSMony floatValue]];
        }else {
            self.fixReceivable4 = textField.text;
            self.fixFqSIQWSMony = [NSString getMoney2:[self.fixReceivable4 floatValue] - [self.fixFqSIQYSMony floatValue]];
        }

    }else if (textField == _receivable5TextFile) {//应收金额5
        if (textField.tag == 3) {
            _receivable5 = textField.text;
            _fqWQWSMony = [NSString getMoney2:[_receivable5 floatValue] - [_fqWQYSMony floatValue]];
        }else {
            self.fixReceivable5 = textField.text;
            self.fixFqWQWSMony = [NSString getMoney2:[self.fixReceivable5 floatValue] - [self.fixFqWQYSMony floatValue]];
        }

    }else if (textField == _receivable6TextFile) {//应收金额6
        if (textField.tag == 3) {
            _receivable6 = textField.text;
            _zhSFWSMony = [NSString getMoney2:[_receivable6 floatValue] - [_zhSFYSMony floatValue]];
        }else {
            self.fixReceivable6 = textField.text;
            self.fixZhSFWSMony = [NSString getMoney2:[self.fixReceivable6 floatValue] - [self.fixZhSFYSMony floatValue]];
        }

        
    }else if (textField == _receivable7TextFile) {//应收金额7

        if (textField.tag == 3) {
            _receivable7 = textField.text;
            _zhSYWSMony = [NSString getMoney2:[_receivable7 floatValue] - [_zhSYYSMony floatValue]];
        }else {
            self.fixReceivable7 = textField.text;
             self.fixZhSYWSMony = [NSString getMoney2:[self.fixReceivable7 floatValue] - [self.fixZhSYYSMony floatValue]];
        }

        
    }else if (textField == _receivable8TextFile) {//应收金额8

        if (textField.tag == 3) {
            _receivable8 = textField.text;
            _zhgjjWSMony = [NSString getMoney2:[_receivable8 floatValue] - [_zhgjjYSMony floatValue]];
        }else {
            self.fixReceivable8 = textField.text;
             self.fixZhgjjWSMony = [NSString getMoney2:[self.fixReceivable8 floatValue] - [self.fixZhgjjYSMony floatValue]];
        }

        
    }else if (textField == _receivable9TextFile) {//应收金额8
        
        if (textField.tag == 3) {
            _receivable9 = textField.text;
            _sySFWSMony = [NSString getMoney2:[_receivable9 floatValue] - [_sySFYSMony floatValue]];
        }else {
            self.fixReceivable9 = textField.text;
             self.fixSySFWSMony = [NSString getMoney2:[self.fixReceivable9 floatValue] - [self.fixSySFYSMony floatValue]];
        }


    }else if (textField == _receivable10TextFile) {//应收金额8
        if (textField.tag == 3) {
            _receivable10 = textField.text;
            _syWSMony = [NSString getMoney2:[_receivable10 floatValue] - [_syYSMony floatValue]];
        }else {
            self.fixReceivable10 = textField.text;
            self.fixSyWSMony = [NSString getMoney2:[self.fixReceivable10 floatValue] - [self.fixSyYSMony floatValue]];
        }
       

        
    }else if (textField == _receivable11TextFile) {//应收金额8
       
        if (textField.tag == 3) {
            _receivable11 = textField.text;
            _gjjSFWSMony = [NSString getMoney2:[_receivable11 floatValue] - [_gjjSFYSMony floatValue]];
        }else {
            self.fixReceivable11 = textField.text;
            self.fixGjjSFWSMony = [NSString getMoney2:[self.fixReceivable11 floatValue] - [self.fixGjjSFYSMony floatValue]];
        }
        
        [_tableView reloadData];
        
    }else if (textField == _receivable12TextFile) {//应收金额8
      
        if (textField.tag == 3) {
            _receivable12 = textField.text;
            _gjjWSMony = [NSString getMoney2:[_receivable12 floatValue] - [_gjjYSMony floatValue]];
        }else {
            self.fixReceivable12 = textField.text;
            self.fixGjjWSMony = [NSString getMoney2:[self.fixReceivable12 floatValue] - [self.fixGjjYSMony floatValue]];
        }
        
    }else if (textField == _signedCodeTextFile) {
        _signedCode = textField.text;


    }else if (textField == _zhZjMoneyTextField) {//折后总价
        _discountAfterAmount = textField.text;
        [self calculateSellAmount];
    }else if (textField == _zkMoneyTextField) {//折扣金额
        _discountAmount = textField.text;
        if ([NSString isStringEmpty2:_discountTotalPrice] == NO) {
            float dis1 = [_discountAmount floatValue];
            float dis2 = [_discountTotalPrice floatValue];
            if (dis1 < dis2) {
                if (dis1 != 0) {
                    float dis3 = [_calculateArea floatValue];
                    
                    float d1 = (1 - (dis1/dis2))*100;
                    float d2 = (dis2-dis1);
                    float d3 = (d2/dis3);
                    float dis4 = [_discountRate floatValue];
                    if (d1 < dis4) {
                        _fq2Cellrow3H = 90;
                    }else {
                        _fq2Cellrow3H = 50;
                    }
                    if (d1 > 0) {
                        NSString *str = [NSString getMoney2:d1];
                        _addDiscountRate = str;
                    }else {
                        _addDiscountRate = @"0";
                    }
                    
                    _contractPrice = [NSString getVal:2 val:d3];
                    _contractAmount = [NSString getVal:2 val:d2];

                }else {
                    //                    _discountAmount = @"0";//
                    _addDiscountRate = @"100.00";
                    _contractPrice = [NSString getVal:2 val:[_discountPrice floatValue]];
                    _contractAmount = [NSString getVal:2 val:[_discountTotalPrice floatValue]];
                }
            }else {
                [self showToast:@"输入的比折前总价大"];
            }

        }
    }else if (textField == _zkBLTextField) {
        _addDiscountRate = textField.text;


    }else if (textField == _tsZKTextField) {//优惠原因
        _preferentialReasons = textField.text;


    }else if (textField == _discountNoteTextField) {
        _discountNote = textField.text;


    }else if (textField == _memberNameTextField) {
        _memberName = textField.text;

    }else if (textField == _khZJHTextField) {
        _documentNumber = textField.text;


    }else if (textField == _khxxTextField) {

    }else if (textField == _khxxZJHTextField) {

    }else if (textField == _fyBLTextField) {
        
        //        NSMutableDictionary *dict = [_jJRDataArr objectAtIndex:textField.tag];
        //        if ([NSString isStringEmpty2:textField.text] == NO) {
        //            [dict setObject:textField.text forKey:@"proportionCommission"];
        //        }else {
        //            [dict setObject:@"" forKey:@"proportionCommission"];
        //        }
        [_tableView reloadData];
    }else if (textField == _referenceNameTextField){
        _referenceName = textField.text;
       
    }
    [self calculateFixHouseTotalMoney];
   
     [_tableView reloadData];
}

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

{
    NSLog(@"-----------> %ld", textField.keyboardType);
    
    if(textField.keyboardType != 8) return YES;

    
    if ([textField.text rangeOfString:@"."].location==NSNotFound) {
        
        _isHaveDian = NO;
        
    }

    if ([string length]>0)
        
    {
        
        unichar single=[string characterAtIndex:0];//当前输入的字符
        
        if ((single >='0' && single<='9') || single=='.')//数据格式正确
            
        {
            
            //首字母不能为0和小数点
            
            if([textField.text length]==0){
                
                if(single == '.'){
                    
                    //                    [self alertView:@"亲，第一个数字不能为小数点"];
                    
                    [textField.text stringByReplacingCharactersInRange:range withString:@""];
                    
                    return NO;
                    
                }
                
                if (single == '0') {
                    
                    //                    [self alertView:@"亲，第一个数字不能为0"];
                    
                    [textField.text stringByReplacingCharactersInRange:range withString:@""];
                    
                    return NO;
                    
                }
                
            }
            
            if (single=='.')
                
            {
                
                if(!_isHaveDian)//text中还没有小数点
                    
                {
                    
                    _isHaveDian=YES;
                    
                    return YES;
                    
                }else
                    
                {
                    
                    //                    [self alertView:@"亲，您已经输入过小数点了"];
                    
                    [textField.text stringByReplacingCharactersInRange:range withString:@""];
                    
                    return NO;
                    
                }
                
            }
            
            else
                
            {
                
                if (_isHaveDian)//存在小数点
                    
                {
                    
                    //判断小数点的位数
                    
                    NSRange ran=[textField.text rangeOfString:@"."];
                    
                    NSInteger tt = range.location-ran.location;
                    
                    if (tt <= 2){
                        
                        return YES;
                        
                    }else{
                        
                        //                        [self alertView:@"亲，您最多输入两位小数"];
                        
                        return NO;
                        
                    }
                    
                }
                
                else
                    
                {
                    
                    return YES;
                    
                }
                
            }
            
        }else{//输入的数据格式不正确
            
            //            [self alertView:@"亲，您输入的格式不正确"];
            
            [textField.text stringByReplacingCharactersInRange:range withString:@""];
            
            return NO;
            
        }
        
    }
    
    else
    {
        
        return YES;
        
    }
    
}

- (void)calculateFixHouseTotalMoney {
    // 计算装修款总金额
    if([self.fixPaymentType isEqualToString:@"一次性付款"]) {
        self.fixHouseTotal = self.fixReceivable;
    }else if([self.fixPaymentType isEqualToString:@"分期付款"]){
        CGFloat total = [self.fixReceivable1 floatValue] + [self.fixReceivable2 floatValue] + [self.fixReceivable3 floatValue] + [self.fixReceivable4 floatValue] + [self.fixReceivable5 floatValue];
        self.fixHouseTotal = [NSString stringWithFormat:@"%.2f",total];
    }else if ([self.fixPaymentType isEqualToString:@"商业按揭"]) {
        CGFloat total = [self.fixReceivable9 floatValue] + [self.fixReceivable10 floatValue];
        self.fixHouseTotal = [NSString stringWithFormat:@"%.2f", total];
    }
    // 合同总金额 = 合同金额 + 装修款金额
    //    _contractAmount
    CGFloat amount = [self.contractAmount floatValue] + [self.fixHouseTotal floatValue];
    self.totalAmount = [NSString stringWithFormat:@"%.2f", amount];
    
}

#pragma mark - 邮寄地址和备注textview代理方法
- (void)textViewDidBeginEditing:(UITextView *)textView{
    if (textView == _mailPostTV) {//邮寄地址
        if ([textView.text isEqualToString:@"请输入邮寄地址"]) {
            textView.text = nil;
            _mailPostTV.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
        }else{
            _mailPostTV.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
        }
    }
    if (textView == _remarkTV) {//备注
        if ([textView.text isEqualToString:@"备注"]) {
            textView.text = nil;
            _remarkTV.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
        }else{
            _remarkTV.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
        }
    }
}

- (void)textViewDidChange:(UITextView *)textView{
    if (textView == _mailPostTV) {//邮寄地址
        _mailPost = textView.text;
        _mailPostTVHeight = [self heightForString:_mailPostTV andWidth:EMM_WIDTH - 100];
    }
    if (textView == _remarkTV) {//备注
        _remark = textView.text;
        _remarkTVHeight = [self heightForString:_remarkTV andWidth:EMM_WIDTH - 100];
    }
}
- (void)textViewDidEndEditing:(UITextView *)textView{

     [_tableView reloadData];
}
//计算textView的高度
- (float) heightForString:(UITextView *)textView andWidth:(float)width{
    CGSize sizeToFit = [textView sizeThatFits:CGSizeMake(width, MAXFLOAT)];
    return sizeToFit.height;
}
//--------------------------------------------------------------------------------------------------
//-------------------------------------------保存、提交-api-------------------------------------------
//--------------------------------------------------------------------------------------------------

#pragma mark - 保存
- (void)bcBtnClick:(UIButton *)btn {
    
    
    //    if (_signedCode.length == 0) {//认购编号
    //        [self showToast:@"签约编号未填写"];
    //        return;
    //    }
    if (_qyRoomId.length == 0) {
        [self showToast:@"签约房源未选择"];
        return ;
    }
    if (_memberName.length == 0) {
        [self showToast:@"客户姓名未填写"];
        return ;
    }
    //
        if (_documentName.length == 0) {
            [self showToast:@"证件类型未选择"];
            return ;
        }
        if (_documentNumber.length == 0) {
            [self showToast:@"证件号未填写"];
            return ;
        }
        if (_mobile.length == 0) {
            [self showToast:@"手机号码未填写"];
            return ;
        }
    //    if (_mailPost.length == 0) {
    //        [self showToast:@"邮寄地址未填写"];
    //        return ;
    //    }
//    if (_postcode.length != 0) {
//        if (_postcode.length >6) {
//            [self showToast:@"邮编不超过六位"];
//            return;
//        }
//        
//    }
    if (_khxxDataArr.count > 0) {
        for (int i = 0; i < _khxxDataArr.count; i++) {
            NSMutableDictionary *dict = [_khxxDataArr objectAtIndex:i];
            NSString *memberName = [dict objectForKey:@"memberName"];
            NSString *documentType = [dict objectForKey:@"documentType"];
            NSString *documentNumber = [dict objectForKey:@"documentNumber"];
            if ([NSString isStringEmpty2:memberName] == YES) {
                [self showToast:@"新增客户信息名字未填写"];
                return;
            }
            if ([NSString isStringEmpty2:documentType] == YES) {
                [self showToast:@"新增客户信息证件类未选择"];
                return;
            }
            if ([NSString isStringEmpty2:documentNumber] == YES) {
                [self showToast:@"新增客户信息证件号未填写"];
                return;
            }
        }
    }
    
    if (![self checkPaymentMethods])return;
    
    if (_dealCategory.length == 0) {
        [self showToast:@"成交类别未选择"];
        return ;
    }
    
    if (_jJRDataArr.count == 0) {
        [self showToast:@"未添加经纪人"];
        return;
    }
    
    if (_jJRDataArr.count == 1) {
        NSMutableDictionary *dict = [_jJRDataArr objectAtIndex:0];
        NSString *relationAgentName = [dict objectForKey:@"relationAgentName"];
        if (relationAgentName.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission = [dict objectForKey:@"proportionCommission"];
        if (proportionCommission.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        if ([proportionCommission floatValue] != 100) {
            [self showToast:@"分佣比例不等于100%，请重新填写！"];
            return;
        }
    }else if (_jJRDataArr.count == 2) {
        NSMutableDictionary *dict = [_jJRDataArr objectAtIndex:0];
        NSString *relationAgentName = [dict objectForKey:@"relationAgentName"];
        if (relationAgentName.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission = [dict objectForKey:@"proportionCommission"];
        if (proportionCommission.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        
        NSMutableDictionary *dict1 = [_jJRDataArr objectAtIndex:1];
        NSString *relationAgentName1 = [dict1 objectForKey:@"relationAgentName"];
        if (relationAgentName1.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission1 = [dict1 objectForKey:@"proportionCommission"];
        if (proportionCommission1.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        
        if ([relationAgentName isEqualToString:relationAgentName1]) {
            [self showToast:@"不能选择相同的经纪人"];
            return;
        }
        
        if (([proportionCommission floatValue] + [proportionCommission1 floatValue]) != 100) {
            [self showToast:@"分佣比例不等于100%，请重新填写！"];
            return;
        }
    }else if (_jJRDataArr.count == 3) {
        NSMutableDictionary *dict = [_jJRDataArr objectAtIndex:0];
        NSString *relationAgentName = [dict objectForKey:@"relationAgentName"];
        if (relationAgentName.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission = [dict objectForKey:@"proportionCommission"];
        if (proportionCommission.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        
        NSMutableDictionary *dict1 = [_jJRDataArr objectAtIndex:1];
        NSString *relationAgentName1 = [dict1 objectForKey:@"relationAgentName"];
        if (relationAgentName1.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission1 = [dict1 objectForKey:@"proportionCommission"];
        if (proportionCommission1.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        
        NSMutableDictionary *dict2 = [_jJRDataArr objectAtIndex:2];
        NSString *relationAgentName2 = [dict2 objectForKey:@"relationAgentName"];
        if (relationAgentName2.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission2 = [dict2 objectForKey:@"proportionCommission"];
        if (proportionCommission2.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        if ([relationAgentName isEqualToString:relationAgentName1]) {
            [self showToast:@"不能选择相同的经纪人"];
            return;
        }
        if ([relationAgentName isEqualToString:relationAgentName2]) {
            [self showToast:@"不能选择相同的经纪人"];
            return;
        }
        if ([relationAgentName1 isEqualToString:relationAgentName2]) {
            [self showToast:@"不能选择相同的经纪人"];
            return;
        }
        if (([proportionCommission floatValue] + [proportionCommission1 floatValue] + [proportionCommission2 floatValue]) != 100) {
            [self showToast:@"分佣比例不等于100%，请重新填写！"];
            return;
        }
    }
    
    if ([_dealCategory isEqualToString:@"推荐成交"]) {
        if (_referenceName.length == 0) {
            [self showToast:@"推荐人不能为空"];
            return;
        }
    }
    
    
    if (_signedDate.length == 0) {
        [self showToast:@"签约日期未选择"];
        return ;
    }
    
    if ([_floorType isEqualToString:@"0"]) {
        
    }else {
        
        if ([_discountApproval isEqualToString:@"0"]) {
        }else {
            if ([NSString isStringEmpty2:_preferentialReasons] == YES) {
                [self showToast:@"优惠原因未填写"];
                return;
            }
        }
    }
    
    [self showHudInWindow:@"正在请求稍等......"];
    
    NSMutableArray *arr = [[NSMutableArray alloc] init];
    
    if (_imageList.count > 0) {
        for (int j = 0; j < _imageList.count; j++) {
            NSMutableDictionary *dictImage = [_imageList objectAtIndex:j];
            NSString *headType = [dictImage objectForKey:@"headType"];
            if ([headType isEqualToString:@"1"] ) {
                [arr addObject:dictImage];
            }
        }
    }
    
    [_imageList removeAllObjects];
    
    for (int j = 0; j < arr.count; j++) {
        NSMutableDictionary *dictImage = [arr objectAtIndex:j];
        [_imageList addObject:dictImage];
    }
    for (int i=0; i<_picArray.count; i++) {
        NSMutableDictionary *dictPic = [_picArray objectAtIndex:i];
        NSString *type = [dictPic objectForKey:@"type"];
        if ([type isEqualToString:@"1"]) {
           
            NSData* imageData = UIImageJPEGRepresentation([dictPic objectForKey:@"image"], 0.1);
            NSString *base64EncodedString = [NSString base64StringFromData:imageData length:[imageData length]];
            NSString *encodedImageStr = base64EncodedString;
            NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
            [dict setObject:encodedImageStr forKey:@"signedUrl"];
            [dict setObject:@".png" forKey:@"headType"];
            [_imageList addObject:dict];
            
        }else if ([type isEqualToString:@"2"]){
            
            NSString *url = [dictPic objectForKey:@"image"];
            NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
            [dict setObject:url forKey:@"signedUrl"];
            NSString *str = @"0";
            [dict setObject:str forKey:@"headType"];
            [_imageList addObject:dict];
        }
    }
    
    if (_isAdd == YES) {
        //        if (_imageList.count == 0) {
        //            [self showToast:@"合同扫描件未添加"];
        //            return ;
        //        }
        [self postAddAuditStatus:@"0"];
    }else {//修改
        
        [self postEAuditStatus:@"0"];
    }
}

- (BOOL)checkPaymentMethods {
    
    //记录装修款数据
    if(self.fixOff.isOn) {
        if (self.fixPaymentType.length == 0) {
            [self showToast:@"付款方式未选择"];
            return NO;
        }else {
            [self.fixHousePaymentMethods removeAllObjects];
            if ([self.fixPaymentType isEqualToString:@"一次性付款"]) {
                if (self.fixReceivable.length == 0) {
                    [self showToast:@"应收金额未填写"];
                    return NO;
                }
                
                float wsje = [self.fixReceivable floatValue];
                float htje = [self.fixHouseTotal floatValue];
                
                if (wsje != htje) {
                    [self showToast:@"应收金额相加应等于合同金额"];
                    return NO;
                }
                
                if (self.fixReceivableDate.length == 0) {
                    [self showToast:@"应收日期未选择"];
                    return NO;
                }
                NSMutableDictionary *dict = [NSMutableDictionary dictionary];
                [dict setObject:@"一次性全款" forKey:@"payContent"];
                [dict setObject:self.fixReceivable forKey:@"receivable"];
                [dict setObject:self.fixReceivableDate forKey:@"receivableDate"];
                [self.fixHousePaymentMethods addObject:dict];
            }else if ([self.fixPaymentType isEqualToString:@"分期付款"]) {
                if (self.fixReceivable1.length == 0) {
                    [self showToast:@"一期款未填写"];
                    return NO;
                }
                if (self.fixReceivableData1.length == 0) {
                    [self showToast:@"一期款应收日期未选择"];
                    return NO;
                }
                
                float yq1 = [self.fixReceivable1 floatValue];
                float yq2 = [self.fixReceivable2 floatValue];
                float yq3 = [self.fixReceivable3 floatValue];
                float yq4 = [self.fixReceivable4 floatValue];
                float yq5 = [self.fixReceivable5 floatValue];
                
                float htje = [self.fixHouseTotal floatValue];
                float zjje = yq1 + yq2 + yq3 + yq4 + yq5;
                
                if (zjje != htje) {
                    [self showToast:@"应收金额相加应等于合同金额"];
                    return NO;
                }
                
                NSMutableDictionary *dict1 = [NSMutableDictionary dictionary];
                [dict1 setObject:@"一期款" forKey:@"payContent"];
                [dict1 setObject:self.fixReceivable1 forKey:@"receivable"];
                [dict1 setObject:self.fixReceivableData1 forKey:@"receivableDate"];
                [_paymentMethodList addObject:dict1];
                
                
                
                if ([NSString isStringEmpty2:self.fixReceivable2] == NO) {
                    if ([NSString isStringEmpty2:self.fixReceivableData2] == YES) {
                        [self showToast:@"请选择二期应收日期"];
                        return NO;
                    }
                    NSMutableDictionary *dict2 = [NSMutableDictionary dictionary];
                    [dict2 setObject:@"二期款" forKey:@"payContent"];
                    [dict2 setObject:self.fixReceivable2 forKey:@"receivable"];
                    [dict2 setObject:self.fixReceivableData2 forKey:@"receivableDate"];
                    [_paymentMethodList addObject:dict2];
                }
                
                if ([NSString isStringEmpty2:self.fixReceivable3] == NO) {
                    if ([NSString isStringEmpty2:self.fixReceivableData3] == YES) {
                        [self showToast:@"请选择三期应收日期"];
                        return NO;
                    }
                    
                    NSMutableDictionary *dict3 = [NSMutableDictionary dictionary];
                    [dict3 setObject:@"三期款" forKey:@"payContent"];
                    [dict3 setObject:self.fixReceivable3 forKey:@"receivable"];
                    [dict3 setObject:self.fixReceivableData3 forKey:@"receivableDate"];
                    [_paymentMethodList addObject:dict3];
                }
                
                if ([NSString isStringEmpty2:self.fixReceivable4] == NO) {
                    if ([NSString isStringEmpty2:self.fixReceivableData4] == YES) {
                        [self showToast:@"请选择四期应收日期"];
                        return NO;
                    }
                    
                    NSMutableDictionary *dict4 = [NSMutableDictionary dictionary];
                    [dict4 setObject:@"四期款" forKey:@"payContent"];
                    [dict4 setObject:self.fixReceivable4 forKey:@"receivable"];
                    [dict4 setObject:self.fixReceivableData4 forKey:@"receivableDate"];
                    [_paymentMethodList addObject:dict4];
                }
                
                if ([NSString isStringEmpty2:_receivable5] == NO) {
                    if ([NSString isStringEmpty2:_receivableDate5] == YES) {
                        [self showToast:@"请选择五期应收日期"];
                        return NO;
                    }
                    
                    NSMutableDictionary *dict5 = [NSMutableDictionary dictionary];
                    [dict5 setObject:@"五期款" forKey:@"payContent"];
                    [dict5 setObject:self.fixReceivable5 forKey:@"receivable"];
                    [dict5 setObject:self.fixReceivableData5 forKey:@"receivableDate"];
                    [_paymentMethodList addObject:dict5];
                }
                
                
                
            }else if ([_paymentMethod isEqualToString:@"商业按揭"]) {
                if (self.fixReceivable9.length == 0) {
                    [self showToast:@"首付款未填写"];
                    return NO;
                }
                if (self.fixReceivableData9.length == 0) {
                    [self showToast:@"首付应收日期未选择"];
                    return NO;
                }
                if (self.fixReceivable10.length == 0) {
                    [self showToast:@"商业按揭款未填写"];
                    return NO;
                }
                if (self.fixReceivableData10.length == 0) {
                    [self showToast:@"商业按揭应收日期未选择"];
                    return NO;
                }
                
                float sfje = [self.fixReceivable9 floatValue];
                float syje = [self.fixReceivable10 floatValue];
                float htje = [self.fixHouseTotal floatValue];
                
                if (sfje + syje != htje) {
                    [self showToast:@"应收金额相加应等于合同金额"];
                    return NO;
                }
                
                NSMutableDictionary *dict1 = [NSMutableDictionary dictionary];
                [dict1 setObject:@"首付款" forKey:@"payContent"];
                [dict1 setObject:self.fixReceivable9 forKey:@"receivable"];
                [dict1 setObject:self.fixReceivableData9 forKey:@"receivableDate"];
                [_paymentMethodList addObject:dict1];
                NSMutableDictionary *dict2 = [NSMutableDictionary dictionary];
                [dict2 setObject:@"按揭银行" forKey:@"payContent"];
                [dict2 setObject:self.fixReceivable10 forKey:@"receivable"];
                [dict2 setObject:self.fixReceivableData10 forKey:@"receivableDate"];
                [_paymentMethodList addObject:dict2];
            }
        
    }
}

    // 付款
    if (_paymentMethod.length == 0) {
        [self showToast:@"付款方式未选择"];
        return NO;
    }else {
        [_paymentMethodList removeAllObjects];
        if ([_paymentMethod isEqualToString:@"一次性付款"]) {
            if (_receivable.length == 0) {
                [self showToast:@"应收金额未填写"];
                return NO;
            }
            
            float wsje = [_receivable floatValue];
            float htje = [_contractAmount floatValue];
            
            if (wsje != htje) {
                [self showToast:@"应收金额相加应等于合同金额"];
                return NO;
            }
            
            if (_receivableDate.length == 0) {
                [self showToast:@"应收日期未选择"];
                return NO;
            }
            NSMutableDictionary *dict = [NSMutableDictionary dictionary];
            [dict setObject:@"一次性全款" forKey:@"payContent"];
            [dict setObject:_receivable forKey:@"receivable"];
            [dict setObject:_receivableDate forKey:@"receivableDate"];
            [_paymentMethodList addObject:dict];
        }else if ([_paymentMethod isEqualToString:@"分期付款"]) {
            if (_receivable1.length == 0) {
                [self showToast:@"一期款未填写"];
                return NO;
            }
            if (_receivableDate1.length == 0) {
                [self showToast:@"一期款应收日期未选择"];
                return NO;
            }
            
            //            if (_receivable2.length == 0) {
            //                [self showToast:@"二期款未填写"];
            //                return ;
            //            }
            //            if (_receivableDate2.length == 0) {
            //                [self showToast:@"二期款应收日期未选择"];
            //                return ;
            //            }
            //            if (_receivable3.length == 0) {
            //                [self showToast:@"三期款未填写"];
            //                return ;
            //            }
            //            if (_receivableDate3.length == 0) {
            //                [self showToast:@"三期款应收日期未选择"];
            //                return ;
            //            }
            //            if (_receivable4.length == 0) {
            //                [self showToast:@"四期款未填写"];
            //                return ;
            //            }
            //            if (_receivableDate4.length == 0) {
            //                [self showToast:@"四期款应收日期未选择"];
            //                return ;
            //            }
            //            if (_receivable5.length == 0) {
            //                [self showToast:@"五期款未填写"];
            //                return ;
            //            }
            //            if (_receivableDate5.length == 0) {
            //                [self showToast:@"五期款应收日期未选择"];
            //                return ;
            //            }
            
            float yq1 = [_receivable1 floatValue];
            float yq2 = [_receivable2 floatValue];
            float yq3 = [_receivable3 floatValue];
            float yq4 = [_receivable4 floatValue];
            float yq5 = [_receivable5 floatValue];
            
            float htje = [_contractAmount floatValue];
            float zjje = yq1 + yq2 + yq3 + yq4 + yq5;
            
            if (zjje != htje) {
                [self showToast:@"应收金额相加应等于合同金额"];
                return NO;
            }
            
            NSMutableDictionary *dict1 = [NSMutableDictionary dictionary];
            [dict1 setObject:@"一期款" forKey:@"payContent"];
            [dict1 setObject:_receivable1 forKey:@"receivable"];
            [dict1 setObject:_receivableDate1 forKey:@"receivableDate"];
            [_paymentMethodList addObject:dict1];
            
            
            
            if ([NSString isStringEmpty2:_receivable2] == NO) {
                if ([NSString isStringEmpty2:_receivableDate2] == YES) {
                    [self showToast:@"请选择二期应收日期"];
                    return NO;
                }
                NSMutableDictionary *dict2 = [NSMutableDictionary dictionary];
                [dict2 setObject:@"二期款" forKey:@"payContent"];
                [dict2 setObject:_receivable2 forKey:@"receivable"];
                [dict2 setObject:_receivableDate2 forKey:@"receivableDate"];
                [_paymentMethodList addObject:dict2];
            }
            
            if ([NSString isStringEmpty2:_receivable3] == NO) {
                if ([NSString isStringEmpty2:_receivableDate3] == YES) {
                    [self showToast:@"请选择三期应收日期"];
                    return NO;
                }
                
                NSMutableDictionary *dict3 = [NSMutableDictionary dictionary];
                [dict3 setObject:@"三期款" forKey:@"payContent"];
                [dict3 setObject:_receivable3 forKey:@"receivable"];
                [dict3 setObject:_receivableDate3 forKey:@"receivableDate"];
                [_paymentMethodList addObject:dict3];
            }
            
            if ([NSString isStringEmpty2:_receivable4] == NO) {
                if ([NSString isStringEmpty2:_receivableDate4] == YES) {
                    [self showToast:@"请选择四期应收日期"];
                    return NO;
                }
                
                NSMutableDictionary *dict4 = [NSMutableDictionary dictionary];
                [dict4 setObject:@"四期款" forKey:@"payContent"];
                [dict4 setObject:_receivable4 forKey:@"receivable"];
                [dict4 setObject:_receivableDate4 forKey:@"receivableDate"];
                [_paymentMethodList addObject:dict4];
            }
            
            if ([NSString isStringEmpty2:_receivable5] == NO) {
                if ([NSString isStringEmpty2:_receivableDate5] == YES) {
                    [self showToast:@"请选择五期应收日期"];
                    return NO;
                }
                
                NSMutableDictionary *dict5 = [NSMutableDictionary dictionary];
                [dict5 setObject:@"五期款" forKey:@"payContent"];
                [dict5 setObject:_receivable5 forKey:@"receivable"];
                [dict5 setObject:_receivableDate5 forKey:@"receivableDate"];
                [_paymentMethodList addObject:dict5];
            }
            
            
            
        }else if ([_paymentMethod isEqualToString:@"商业按揭"]) {
            if (_receivable9.length == 0) {
                [self showToast:@"首付款未填写"];
                return NO;
            }
            if (_receivableDate9.length == 0) {
                [self showToast:@"首付应收日期未选择"];
                return NO;
            }
            if (_receivable10.length == 0) {
                [self showToast:@"商业按揭款未填写"];
                return NO;
            }
            if (_receivableDate10.length == 0) {
                [self showToast:@"商业按揭应收日期未选择"];
                return NO;
            }
            
            float sfje = [_receivable9 floatValue];
            float syje = [_receivable10 floatValue];
            float htje = [_contractAmount floatValue];
            
            if (sfje + syje != htje) {
                [self showToast:@"应收金额相加应等于合同金额"];
                return NO;
            }
            
            NSMutableDictionary *dict1 = [NSMutableDictionary dictionary];
            [dict1 setObject:@"首付款" forKey:@"payContent"];
            [dict1 setObject:_receivable9 forKey:@"receivable"];
            [dict1 setObject:_receivableDate9 forKey:@"receivableDate"];
            [_paymentMethodList addObject:dict1];
            NSMutableDictionary *dict2 = [NSMutableDictionary dictionary];
            [dict2 setObject:@"按揭银行" forKey:@"payContent"];
            [dict2 setObject:_receivable10 forKey:@"receivable"];
            [dict2 setObject:_receivableDate10 forKey:@"receivableDate"];
            [_paymentMethodList addObject:dict2];
        }else if ([_paymentMethod isEqualToString:@"公积金按揭"]) {
            if (_receivable11.length == 0) {
                [self showToast:@"首付款未填写"];
                return NO;
            }
            if (_receivableDate11.length == 0) {
                [self showToast:@"首付应收日期未选择"];
                return NO;
            }
            
            if (_receivable12.length == 0) {
                [self showToast:@"公积金按揭款未填写"];
                return NO;
            }
            if (_receivableDate12.length == 0) {
                [self showToast:@"公积金按揭款应收日期未选择"];
                return NO;
            }
            
            float sfje = [_receivable11 floatValue];
            float syje = [_receivable12 floatValue];
            float htje = [_contractAmount floatValue];
            
            if (sfje + syje != htje) {
                [self showToast:@"应收金额相加应等于合同金额"];
                return NO;
            }
            
            NSMutableDictionary *dict1 = [NSMutableDictionary dictionary];
            [dict1 setObject:@"首付款" forKey:@"payContent"];
            [dict1 setObject:_receivable11 forKey:@"receivable"];
            [dict1 setObject:_receivableDate11 forKey:@"receivableDate"];
            [_paymentMethodList addObject:dict1];
            NSMutableDictionary *dict2 = [NSMutableDictionary dictionary];
            [dict2 setObject:@"公积金" forKey:@"payContent"];
            [dict2 setObject:_receivable12 forKey:@"receivable"];
            [dict2 setObject:_receivableDate12 forKey:@"receivableDate"];
            [_paymentMethodList addObject:dict2];
        }else if ([_paymentMethod isEqualToString:@"组合贷款"]) {
            if (_receivable6.length == 0) {
                [self showToast:@"首付款未填写"];
                return NO;
            }
            if (_receivableDate6.length == 0) {
                [self showToast:@"首付应收日期未选择"];
                return NO;
            }
            if (_receivable7.length == 0) {
                [self showToast:@"商业按揭款未填写"];
                return NO;
            }
            if (_receivableDate7.length == 0) {
                [self showToast:@"商业按揭应收日期未选择"];
                return NO;
            }
            
            if (_receivable8.length == 0) {
                [self showToast:@"公积金按揭款未填写"];
                return NO;
            }
            if (_receivableDate8.length == 0) {
                [self showToast:@"公积金按揭款应收日期未选择"];
                return NO;
            }
            
            float sfje = [_receivable6 floatValue];
            
            float syje = [_receivable7 floatValue];
            
            float gjje = [_receivable8 floatValue];
            
            float htje = [_contractAmount floatValue];
            
            if (sfje + syje + gjje != htje) {
                [self showToast:@"应收金额相加应等于合同金额"];
                return NO;
            }
            
            NSMutableDictionary *dict1 = [NSMutableDictionary dictionary];
            [dict1 setObject:@"首付款" forKey:@"payContent"];
            [dict1 setObject:_receivable6 forKey:@"receivable"];
            [dict1 setObject:_receivableDate6 forKey:@"receivableDate"];
            [_paymentMethodList addObject:dict1];
            NSMutableDictionary *dict2 = [NSMutableDictionary dictionary];
            [dict2 setObject:@"按揭银行" forKey:@"payContent"];
            [dict2 setObject:_receivable7 forKey:@"receivable"];
            [dict2 setObject:_receivableDate7 forKey:@"receivableDate"];
            [_paymentMethodList addObject:dict2];
            NSMutableDictionary *dict3 = [NSMutableDictionary dictionary];
            [dict3 setObject:@"公积金" forKey:@"payContent"];
            [dict3 setObject:_receivable8 forKey:@"receivable"];
            [dict3 setObject:_receivableDate8 forKey:@"receivableDate"];
            [_paymentMethodList addObject:dict3];
        }
        NSLog(@"%@",_paymentMethodList);
    }
    return YES;
}

#pragma mark -提交
- (void)tjBtnClick:(UIButton *)btn {
    
    //    if (_signedCode.length == 0) {//认购编号
    //        [self showToast:@"签约编号未填写"];
    //        return;
    //    }
    if (_qyRoomId.length == 0) {
        [self showToast:@"签约房源未选择"];
        return ;
    }
    if (_memberName.length == 0) {
        [self showToast:@"客户姓名未填写"];
        return ;
    }
    //
        if (_documentName.length == 0) {
            [self showToast:@"证件类型未选择"];
            return ;
        }
        if (_documentNumber.length == 0) {
            [self showToast:@"证件号未填写"];
            return ;
        }
        if (_mobile.length == 0) {
            [self showToast:@"手机号码未填写"];
            return ;
        }
    //    if (_mailPost.length == 0) {
    //        [self showToast:@"邮寄地址未填写"];
    //        return ;
    //    }
//    if (_postcode.length != 0) {
//        if (_postcode.length >6) {
//            [self showToast:@"邮编不超过六位"];
//            return;
//        }
//        
//    }
    
    if (_khxxDataArr.count > 0) {
        for (int i = 0; i < _khxxDataArr.count; i++) {
            NSMutableDictionary *dict = [_khxxDataArr objectAtIndex:i];
            NSString *memberName = [dict objectForKey:@"memberName"];
            NSString *documentType = [dict objectForKey:@"documentType"];
            NSString *documentNumber = [dict objectForKey:@"documentNumber"];
            if ([NSString isStringEmpty2:memberName] == YES) {
                [self showToast:@"新增客户信息名字未填写"];
                return;
            }
            if ([NSString isStringEmpty2:documentType] == YES) {
                [self showToast:@"新增客户信息证件类未选择"];
                return;
            }
            if ([NSString isStringEmpty2:documentNumber] == YES) {
                [self showToast:@"新增客户信息证件号未填写"];
                return;
            }
        }
    }
    if (![self checkPaymentMethods])return;
    
    if (_dealCategory.length == 0) {
        [self showToast:@"成交类别未选择"];
        return ;
    }else {
        
    }
    
    if (_jJRDataArr.count == 1) {
        NSMutableDictionary *dict = [_jJRDataArr objectAtIndex:0];
        NSString *relationAgentName = [dict objectForKey:@"relationAgentName"];
        if (relationAgentName.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission = [dict objectForKey:@"proportionCommission"];
        if (proportionCommission.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        
        if ([proportionCommission floatValue] != 100) {
            [self showToast:@"分佣比例不等于100%，请重新填写！"];
            return;
        }
        
    }else if (_jJRDataArr.count == 2) {
        NSMutableDictionary *dict = [_jJRDataArr objectAtIndex:0];
        NSString *relationAgentName = [dict objectForKey:@"relationAgentName"];
        if (relationAgentName.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission = [dict objectForKey:@"proportionCommission"];
        if (proportionCommission.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        
        NSMutableDictionary *dict1 = [_jJRDataArr objectAtIndex:1];
        NSString *relationAgentName1 = [dict1 objectForKey:@"relationAgentName"];
        if (relationAgentName1.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission1 = [dict1 objectForKey:@"proportionCommission"];
        if (proportionCommission1.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        
        if ([relationAgentName isEqualToString:relationAgentName1]) {
            [self showToast:@"不能选择相同的经纪人"];
            return;
        }
        
        if (([proportionCommission floatValue] + [proportionCommission1 floatValue]) != 100) {
            [self showToast:@"分佣比不例等于100%，请重新填写！"];
            return;
        }
    }else if (_jJRDataArr.count == 3) {
        NSMutableDictionary *dict = [_jJRDataArr objectAtIndex:0];
        NSString *relationAgentName = [dict objectForKey:@"relationAgentName"];
        if (relationAgentName.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission = [dict objectForKey:@"proportionCommission"];
        if (proportionCommission.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        
        NSMutableDictionary *dict1 = [_jJRDataArr objectAtIndex:1];
        NSString *relationAgentName1 = [dict1 objectForKey:@"relationAgentName"];
        if (relationAgentName1.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission1 = [dict1 objectForKey:@"proportionCommission"];
        if (proportionCommission1.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        
        NSMutableDictionary *dict2 = [_jJRDataArr objectAtIndex:2];
        NSString *relationAgentName2 = [dict2 objectForKey:@"relationAgentName"];
        if (relationAgentName2.length == 0) {
            [self showToast:@"未选择经纪人"];
            return;
        }
        NSString *proportionCommission2 = [dict2 objectForKey:@"proportionCommission"];
        if (proportionCommission2.length == 0) {
            [self showToast:@"分佣比例未填写"];
            return;
        }
        if ([relationAgentName isEqualToString:relationAgentName1]) {
            [self showToast:@"不能选择相同的经纪人"];
            return;
        }
        if ([relationAgentName isEqualToString:relationAgentName2]) {
            [self showToast:@"不能选择相同的经纪人"];
            return;
        }
        if ([relationAgentName1 isEqualToString:relationAgentName2]) {
            [self showToast:@"不能选择相同的经纪人"];
            return;
        }
        if (([proportionCommission floatValue] + [proportionCommission1 floatValue] + [proportionCommission2 floatValue]) != 100) {
            [self showToast:@"分佣比例不等于100%，请重新填写！"];
            return;
        }
    }
    
    if ([_dealCategory isEqualToString:@"推荐成交"]) {
        if (_referenceName.length == 0) {
            [self showToast:@"推荐人不能为空"];
            return;
        }
    }
    
    if (_signedDate.length == 0) {
        [self showToast:@"签约日期未选择"];
        return ;
    }
    
    if ([_floorType isEqualToString:@"0"]) {
        
    }else {
        
        if ([_discountApproval isEqualToString:@"0"]) {
        }else {
            if ([NSString isStringEmpty2:_preferentialReasons] == YES) {
                [self showToast:@"优惠原因未填写"];
                return;
            }
        }
    }
    
    [self showHudInWindow:@"正在请求稍等......"];
    
    /*
     if ([type isEqualToString:@"1"]) {
     [bigImgArray addObject:[MHPhotoModel photoWithImage:[dict objectForKey:@"image"]]];
     }else if([type isEqualToString:@"2"]){
     [bigImgArray addObject:[MHPhotoModel photoWithURL:[NSURL URLWithString:[dict objectForKey:@"image"]]]];
     }
     */
    NSMutableArray *arr = [[NSMutableArray alloc] init];
    
    if (_imageList.count > 0) {
        for (int j = 0; j < _imageList.count; j++) {
            NSMutableDictionary *dictImage = [_imageList objectAtIndex:j];
            NSString *headType = [dictImage objectForKey:@"headType"];
            if ([headType isEqualToString:@"1"] ) {
                [arr addObject:dictImage];
            }
        }
    }
    
    [_imageList removeAllObjects];
    
    for (int j = 0; j < arr.count; j++) {
        NSMutableDictionary *dictImage = [arr objectAtIndex:j];
        [_imageList addObject:dictImage];
    }
    
    for (int i=0; i<_picArray.count; i++) {
        
        NSMutableDictionary *dictPic = [_picArray objectAtIndex:i];
        NSString *type = [dictPic objectForKey:@"type"];
        if ([type isEqualToString:@"1"]) {
            
            NSData* imageData = UIImageJPEGRepresentation([dictPic objectForKey:@"image"], 0.1);
            NSString *base64EncodedString = [NSString base64StringFromData:imageData length:[imageData length]];
            NSString *encodedImageStr = base64EncodedString;
            NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
            [dict setObject:encodedImageStr forKey:@"signedUrl"];
            [dict setObject:@".png" forKey:@"headType"];
            [_imageList addObject:dict];
        }else if ([type isEqualToString:@"2"]){
            
            NSString *url = [dictPic objectForKey:@"image"];
            NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
            [dict setObject:url forKey:@"signedUrl"];
            NSString *str = @"0";
            [dict setObject:str forKey:@"headType"];
            [_imageList addObject:dict];
        }
    }
    
    if (_isAdd == YES) {
        //        if (_imageList.count == 0) {
        //            [self showToast:@"合同扫描件未添加"];
        //            return ;
        //        }
        [self postAddAuditStatus:@"1"];
    }else {//修改
        
        [self postEAuditStatus:@"1"];
    }
    
}

#pragma mark - 新增Api
- (void)postAddAuditStatus:(NSString *)auditStatus {
    
    AddSignedApi *api = [[AddSignedApi alloc] initWithCustomerId:self.customerId
                                                    payDepositId:_payDepositId
                                                  payDepositCode:_payDepositCode
                                                 payDepositMoney:_payDepositMoney
                                                     subscribeId:_subscribeId
                                                   subscribeCode:_subscribeCode
                                                 subscribeAmount:_subscribeAmount
                                                    signedHouses:_qyRoomId
                                                   calculateArea:_calculateArea
                                                   discountPrice:_discountPrice
                                              discountTotalPrice:_discountTotalPrice
                                                  discountAmount:_discountAmount
                                                    discountRate:_addDiscountRate
                                                discountApproval:_discountApproval
                                             preferentialReasons:_preferentialReasons
                                                    discountNote:_discountNote
                                                   contractPrice:_contractPrice
                                                  contractAmount:_contractAmount
                                                    dealCategory:_dealCategoryId
                                                         agentId:_agentId
                                                      signedDate:_signedDate
                                                      signedCode:_signedCode
                                                          remark:_remark
                                                     auditStatus:auditStatus
                                                    customerName:_memberName
                                                    documentType:_documentType
                                                  documentNumber:_documentNumber
                                                          mobile:_mobile
                                                        mailPost:_mailPost
                                                        postcode:_postcode
                                                   paymentMethod:_paymentMethodId
                                               paymentMethodList:_paymentMethodList
                                                       imageList:_imageList
                                              customerFamilyList:_khxxDataArr
                                                       floorType:_floorType
                                             discountAfterAmount:_discountAfterAmount
                                                dealCategoryList:_jJRDataArr
                                                     referenceId:_referenceId
                                                   referenceName:_referenceName
                                             referenceProportion:@"0"
                                                      memberName:_memberName fixHouseMethod:self.fixPaymentId methodList:self.fixHousePaymentMethods decorationMoney:self.fixHouseTotal];
    [api startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) {
        AddSignedApi *result = (AddSignedApi *)request;
        if (result.isSuccess) {
            [self hideHud];
            if ([_isTransaction isEqualToString:@"1"]) {
                for (UIViewController *controller in self.navigationController.viewControllers) {
                    if ([controller isKindOfClass:[SignViewController class]]) {
                        [self creatNSNotificationCenter];
                        SignViewController *svc =(SignViewController *)controller;
                        [self.navigationController popToViewController:svc animated:YES];
                    }
                }
            }else {
                if ([result.resultData.result isEqualToString:@"1"]) {
                    [self showToast:result.resultData.errorMsg];
                    if ([NSString isStringEmpty2:result.resultData.errorMsg] == NO) {
                        [self showToast:result.resultData.errorMsg];
                    }else {
                        if (self.houseDetailTo) {
                            [self showToast:@"操作成功"];
                            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.45 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                                [self.navigationController popToRootViewControllerAnimated:YES];
                            });
                        }else {
                            [self.navigationController popViewControllerAnimated:YES];
                        }
                    }
                }else {
                    [self.navigationController popViewControllerAnimated:YES];
                }
            }
           
        } else {
//            [self showToast:result.resultData.errorMsg];
            NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
            NSString *projectCode = [userdf objectForKey:@"projectCode"];
            if ([NSString isStringEmpty2:projectCode] == NO) {
                [self showToast:result.resultData.errorMsg];
            }
            
            /*
             提示语：账号权限发生变动，请重新登录
             code随机18位唯一码：108E65843mYuwqb01X
             //YUplf0wyU5vPVssLSG 对应的异地登录退出登录
             */
            
            if ([result.resultData.errorCode isEqualToString:@"YUplf0wyU5vPVssLSG"] || [result.resultData.errorCode isEqualToString:@"108E65843mYuwqb01X"]) {
                NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
                NSDictionary *dictionary = [defs dictionaryRepresentation];
                for(NSString *key in [dictionary allKeys]){
                    if ([key isEqualToString:@"DeviceToken123"] ||
                        [key isEqualToString:@"loginText"] ||
                        [key isEqualToString:@"provinceCityDistrict"]) {
                    }else {
                        [defs removeObjectForKey:key];
                        [defs synchronize];
                    }
                }
                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:result.resultData.errorMsg preferredStyle:UIAlertControllerStyleAlert];
                UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                    [appInstance showLogin];
                }];
                [alertController addAction:cancelAction];
                [self presentViewController:alertController animated:YES completion:nil];
            }
        }
        [self hideHud];
    } failure:^(YTKBaseRequest *request) {
        [self showToast:@"连接服务器失败，请检查网络！"];
        [self hideHud];
    }];
    
}

#pragma mark - 修改Api
-(void)postEAuditStatus:(NSString *)auditStatus {
    
    EditSignedApi *api = [[EditSignedApi alloc] initWithPayDepositId:_payDepositId
                                                      payDepositCode:_payDepositCode
                                                     payDepositMoney:_payDepositMoney
                                                         subscribeId:_subscribeId
                                                       subscribeCode:_subscribeCode
                                                     subscribeAmount:_subscribeAmount
                                                            signedId:self.signedId
                                                        signedHouses:_qyRoomId
                                                       calculateArea:_calculateArea
                                                       discountPrice:_discountPrice
                                                  discountTotalPrice:_discountTotalPrice
                                                      discountAmount:_discountAmount
                                                        discountRate:_addDiscountRate
                                                    discountApproval:_discountApproval
                                                 preferentialReasons:_preferentialReasons
                                                        discountNote:_discountNote
                                                       contractPrice:_contractPrice
                                                      contractAmount:_contractAmount
                                                        dealCategory:_dealCategoryId
                                                             agentId:_agentId
                                                          signedDate:_signedDate
                                                          signedCode:_signedCode
                                                              remark:_remark
                                                         auditStatus:auditStatus
                                                        customerName:_memberName
                                                        documentType:_documentType
                                                      documentNumber:_documentNumber
                                                              mobile:_mobile
                                                            mailPost:_mailPost
                                                            postcode:_postcode
                                                       paymentMethod:_paymentMethodId
                                                   paymentMethodList:_paymentMethodList
                                                           imageList:_imageList
                                                  customerFamilyList:_khxxDataArr
                                                           floorType:_floorType
                                                 discountAfterAmount:_discountAfterAmount
                                                    dealCategoryList:_jJRDataArr
                                                         referenceId:_referenceId
                                                       referenceName:_referenceName
                                                 referenceProportion:@"0"
                                                          memberName:_memberName fixHouseMethod:self.fixPaymentId methodList:self.fixHousePaymentMethods decorationMoney:self.fixHouseTotal];
    
    [api startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) {
        EditSignedApi *result = (EditSignedApi *)request;
        if (result.isSuccess) {
            [self hideHud];
            if ([result.resultData.result isEqualToString:@"1"]) {
                if ([NSString isStringEmpty2:result.resultData.errorMsg] == NO) {
                    [self showToast:result.resultData.errorMsg];
                }else {
                    if (_signUpViewBlock) {
                        _signUpViewBlock();
                    }
                    [self.navigationController popViewControllerAnimated:YES];
                }
                
            }else {
                NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
                NSString *projectCode = [userdf objectForKey:@"projectCode"];
                if ([NSString isStringEmpty2:projectCode] == NO) {
                    [self showToast:result.resultData.errorMsg];
                }
                
                /*
                 提示语：账号权限发生变动，请重新登录
                 code随机18位唯一码：108E65843mYuwqb01X
                 //YUplf0wyU5vPVssLSG 对应的异地登录退出登录
                 */
                if ([result.resultData.errorCode isEqualToString:@"YUplf0wyU5vPVssLSG"] || [result.resultData.errorCode isEqualToString:@"108E65843mYuwqb01X"]) {
                    NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
                    NSDictionary *dictionary = [defs dictionaryRepresentation];
                    for(NSString *key in [dictionary allKeys]){
                        if ([key isEqualToString:@"DeviceToken123"] ||
                            [key isEqualToString:@"loginText"] ||
                            [key isEqualToString:@"provinceCityDistrict"]) {
                        }else {
                            [defs removeObjectForKey:key];
                            [defs synchronize];
                        }
                    }
                    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:result.resultData.errorMsg preferredStyle:UIAlertControllerStyleAlert];
                    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                        [appInstance showLogin];
                    }];
                    [alertController addAction:cancelAction];
                    [self presentViewController:alertController animated:YES completion:nil];
                }
            }
            
        } else {
            [self showToast:result.resultData.errorMsg];
        }
        [self hideHud];
    } failure:^(YTKBaseRequest *request) {
        [self showToast:@"连接服务器失败，请检查网络！"];
        [self hideHud];
    }];
}

//--------------------------------------------------------------------------------------------------
//-----------------------------------------  网络Api请求---------------------------------------------
//--------------------------------------------------------------------------------------------------

#pragma mark - 查询已收金额
- (void)postGetConsultantListApiBusinessId:(NSString *)businessId
                              businessType:(NSString *)businessType {
    GetSignedHaveAmountApi *api = [[GetSignedHaveAmountApi alloc] initWithBusinessId:businessId businessType:businessType];
    [api startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) {
        GetSignedHaveAmountApi *result = (GetSignedHaveAmountApi *)request;
        if (result.isSuccess) {
            GetSignedHaveAmount *get = result.resultData;
            _getSignedHaveAmount = get;
            if ([NSString isStringEmpty2:_getSignedHaveAmount.realAmount] == NO) {
                _yicxYSFKMony = _getSignedHaveAmount.realAmount;
                _fqYQYSMony = _getSignedHaveAmount.realAmount;
                _zhSFYSMony = _getSignedHaveAmount.realAmount;
                _sySFYSMony = _getSignedHaveAmount.realAmount;
                _gjjSFYSMony = _getSignedHaveAmount.realAmount;
            }else {
                _yicxYSFKMony = self.realAmount;
                _fqYQYSMony = self.realAmount;
                _zhSFYSMony = self.realAmount;
                _sySFYSMony = self.realAmount;
                _gjjSFYSMony = self.realAmount;
            }
        } else {
            if ([result.resultData.errorCode isEqualToString:@"YUplf0wyU5vPVssLSG"] || [result.resultData.errorCode isEqualToString:@"108E65843mYuwqb01X"]) {
                NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
                NSDictionary *dictionary = [defs dictionaryRepresentation];
                for(NSString *key in [dictionary allKeys]){
                    if ([key isEqualToString:@"DeviceToken123"] ||
                        [key isEqualToString:@"loginText"] ||
                        [key isEqualToString:@"provinceCityDistrict"]) {
                    }else {
                        [defs removeObjectForKey:key];
                        [defs synchronize];
                    }
                }
                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:result.resultData.errorMsg preferredStyle:UIAlertControllerStyleAlert];
                UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                    [appInstance showLogin];
                }];
                [alertController addAction:cancelAction];
                [self presentViewController:alertController animated:YES completion:nil];
            }
        }

    } failure:^(YTKBaseRequest *request) {
        [self showToast:@"连接服务器失败，请检查网络！"];
    }];
}

#pragma  mark - 证件号类型

- (void)postGetDictionaryListByProjectIdApi {
    
    GetDictionaryListByProjectIdApi *api = [[GetDictionaryListByProjectIdApi alloc] initWithBusNum:@"01"];
    [api startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) {
        GetDictionaryListByProjectIdApi *result = (GetDictionaryListByProjectIdApi *)request;
        if (result.isSuccess) {
            GetDictionaryListByProjectId *get = result.resultData;
            //12、证件类型
            _zjlxList = [get.typeMap objectForKey:@"documentType"];
        } else {
            [self showToast:result.resultData.errorMsg];
            if ([result.resultData.errorCode isEqualToString:@"YUplf0wyU5vPVssLSG"] || [result.resultData.errorCode isEqualToString:@"108E65843mYuwqb01X"]) {
                NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
                NSDictionary *dictionary = [defs dictionaryRepresentation];
                for(NSString *key in [dictionary allKeys]){
                    if ([key isEqualToString:@"DeviceToken123"] ||
                        [key isEqualToString:@"loginText"] ||
                        [key isEqualToString:@"provinceCityDistrict"]) {
                    }else {
                        [defs removeObjectForKey:key];
                        [defs synchronize];
                    }
                }
                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:result.resultData.errorMsg preferredStyle:UIAlertControllerStyleAlert];
                UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                    [appInstance showLogin];
                }];
                [alertController addAction:cancelAction];
                [self presentViewController:alertController animated:YES completion:nil];
            }
        }
        if (_isAdd == NO) {
            [self hideHud];
        }
        [self creatNavigationController];
        [self initDataSource];
        [_tableView reloadData];
    } failure:^(YTKBaseRequest *request) {
        [self showToast:@"连接服务器失败，请检查网络！"];
        if (_isAdd == NO) {
            [self hideHud];
        }
    }];
}

#pragma  mark - 经纪人
- (void)postGetConsultantListApi {
    [_zyDataArr removeAllObjects];
    [_zyData removeAllObjects];
    GetConsultantListApi *api = [[GetConsultantListApi alloc] initWithResourcesCode:nil searchType:nil];
    [api startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) {
        GetConsultantListApi *result = (GetConsultantListApi *)request;
        if (result.isSuccess) {
            GetConsultantList *get = result.resultData;
            for (ConsultantList *list in get.consultantList) {
                [_zyDataArr addObject:list.consultantUserName];
                [_zyData addObject:list];
                if ([_agentName isEqualToString:list.consultantUserName]) {
                    _agentId = list.consultantUserId;
                }
            }
        } else {
            if ([result.resultData.errorCode isEqualToString:@"YUplf0wyU5vPVssLSG"] || [result.resultData.errorCode isEqualToString:@"108E65843mYuwqb01X"]) {
                NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
                NSDictionary *dictionary = [defs dictionaryRepresentation];
                for(NSString *key in [dictionary allKeys]){
                    if ([key isEqualToString:@"DeviceToken123"] ||
                        [key isEqualToString:@"loginText"] ||
                        [key isEqualToString:@"provinceCityDistrict"]) {
                    }else {
                        [defs removeObjectForKey:key];
                        [defs synchronize];
                    }
                }
                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:result.resultData.errorMsg preferredStyle:UIAlertControllerStyleAlert];
                UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                    [appInstance showLogin];
                }];
                [alertController addAction:cancelAction];
                [self presentViewController:alertController animated:YES completion:nil];
            }
        }
        [_tableView reloadData];
        [self creatNavigationController];
        [self initDataSource];
    } failure:^(YTKBaseRequest *request) {
        [self showToast:@"连接服务器失败，请检查网络！"];
    }];
}

#pragma mark - 推荐成交人
- (void)postGetRecommendCustomerListHanderApi {
    [_recommendCustomerList removeAllObjects];
    [_recommendCustomerNameList removeAllObjects];
    GetRecommendCustomerListHanderApi *api = [[GetRecommendCustomerListHanderApi alloc] initWithResourcesCode:@"menu_0006_0001"];
    [api startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) {
        GetRecommendCustomerListHanderApi *result = (GetRecommendCustomerListHanderApi *)request;
        if (result.isSuccess) {
            GetRecommendCustomerListHander *get = result.resultData;
            for (RecommendCustomerList *list in get.recommendCustomerList) {
                [_recommendCustomerNameList addObject:list.customerName];
                [_recommendCustomerList addObject:list];
            }
        } else {
            NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
            NSString *projectCode = [userdf objectForKey:@"projectCode"];
            if ([NSString isStringEmpty2:projectCode] == NO) {
                [self showToast:result.resultData.errorMsg];
            }
            
            /*
             提示语：账号权限发生变动，请重新登录
             code随机18位唯一码：108E65843mYuwqb01X
             //YUplf0wyU5vPVssLSG 对应的异地登录退出登录
             */
           
            if ([result.resultData.errorCode isEqualToString:@"YUplf0wyU5vPVssLSG"] || [result.resultData.errorCode isEqualToString:@"108E65843mYuwqb01X"]) {
                NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
                NSDictionary *dictionary = [defs dictionaryRepresentation];
                for(NSString *key in [dictionary allKeys]){
                    if ([key isEqualToString:@"DeviceToken123"] ||
                        [key isEqualToString:@"loginText"] ||
                        [key isEqualToString:@"provinceCityDistrict"]) {
                    }else {
                        [defs removeObjectForKey:key];
                        [defs synchronize];
                    }
                }
                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:result.resultData.errorMsg preferredStyle:UIAlertControllerStyleAlert];
                UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                    [appInstance showLogin];
                }];
                [alertController addAction:cancelAction];
                [self presentViewController:alertController animated:YES completion:nil];
            }
        }
        [_tableView reloadData];
    } failure:^(YTKBaseRequest *request) {
        [self showToast:@"连接服务器失败，请检查网络！"];
    }];
}

- (void)postGetCustomerDetailApi {
    [self showHudInWindow:@"正在加载请稍等..."];

    GetCustomerDetailApi *api = [[GetCustomerDetailApi alloc] initWithCustomerId:self.customerId];
    [api startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) {
        GetCustomerDetailApi *result = (GetCustomerDetailApi *)request;
        if (result.isSuccess) {
            GetCustomerDetail *get = result.resultData;
            _memberName = get.customerName;
            _documentName = get.peDocumentType;
            
            for (int i = 0; i < _zjlxList.count; i++) {
                NSMutableDictionary *dict = [_zjlxList objectAtIndex:i];
                if ([_documentName isEqualToString:[dict objectForKey:@"dictionaryName"]]) {
                    _documentType = [dict objectForKey:@"dictionaryId"];
                }
            }
                
            _documentNumber = get.peDocumentNumber;
            _mobile = get.customerPhone;
            if ([NSString isStringEmpty2:get.peContactAddress] == NO) {
                _mailPost = get.peContactAddress;//邮寄地址
                //计算邮寄地址textView的高度
                UITextView *mailPostTV = [[UITextView alloc] initWithFrame:CGRectMake(100, 5, EMM_WIDTH - 100, 50)];
                mailPostTV.font = [UIFont systemFontOfSize:15];
                mailPostTV.text = _mailPost;
                _mailPostTVHeight = [self heightForString:mailPostTV andWidth:EMM_WIDTH - 100];
            }else {
                _mailPost = @"";
            }
            _postcode = get.pePostcode;
        } else {
//            [self showToast:result.resultData.errorMsg];
            NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
            NSString *projectCode = [userdf objectForKey:@"projectCode"];
            if ([NSString isStringEmpty2:projectCode] == NO) {
                [self showToast:result.resultData.errorMsg];
            }
            
            /*
             提示语：账号权限发生变动，请重新登录
             code随机18位唯一码：108E65843mYuwqb01X
             //YUplf0wyU5vPVssLSG 对应的异地登录退出登录
             */
            if ([result.resultData.errorCode isEqualToString:@"YUplf0wyU5vPVssLSG"] || [result.resultData.errorCode isEqualToString:@"108E65843mYuwqb01X"]) {
                NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
                NSDictionary *dictionary = [defs dictionaryRepresentation];
                for(NSString *key in [dictionary allKeys]){
                    if ([key isEqualToString:@"DeviceToken123"] ||
                        [key isEqualToString:@"loginText"] ||
                        [key isEqualToString:@"provinceCityDistrict"]) {
                    }else {
                        [defs removeObjectForKey:key];
                        [defs synchronize];
                    }
                }
                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:result.resultData.errorMsg preferredStyle:UIAlertControllerStyleAlert];
                UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                    [appInstance showLogin];
                }];
                [alertController addAction:cancelAction];
                [self presentViewController:alertController animated:YES completion:nil];
            }
        }

        [_tableView reloadData];
        [self hideHud];

    } failure:^(YTKBaseRequest *request) {
        [self showToast:@"连接服务器失败，请检查网络！"];
        [self hideHud];

    }];
}

#pragma mark - 选择图片
- (void)butonClick:(UIButton *)btn {
    UIActionSheet *choiceSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                             delegate:self
                                                    cancelButtonTitle:@"取消"
                                               destructiveButtonTitle:nil
                                                    otherButtonTitles:@"拍照", @"从相册中选取", nil];
    [choiceSheet showInView:self.view];
    
}


#pragma mark UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 0) {
        // 拍照
        [self showPhotosFromCamera];
        
    } else if (buttonIndex == 1) {
        // 从相册中选取
        [self showSelectPhotos];
        
    }
}


////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark - 调用系统相机和相册
////////////////////////////////////////////////////////////////////////////////////////////////////

#pragma mark camera utility

////////////////////////////////////////////////////////////////////////////////////////////////////

- (BOOL) isCameraAvailable
{
    return [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
}

- (BOOL) isRearCameraAvailable
{
    return [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear];
}

- (BOOL) isFrontCameraAvailable
{
    return [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront];
}

- (BOOL) doesCameraSupportTakingPhotos
{
    return [self cameraSupportsMedia:(__bridge NSString *)kUTTypeImage sourceType:UIImagePickerControllerSourceTypeCamera];
}

- (BOOL) isPhotoLibraryAvailable
{
    return [UIImagePickerController isSourceTypeAvailable:
            UIImagePickerControllerSourceTypePhotoLibrary];
}
- (BOOL) canUserPickVideosFromPhotoLibrary
{
    return [self
            cameraSupportsMedia:(__bridge NSString *)kUTTypeMovie sourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
- (BOOL) canUserPickPhotosFromPhotoLibrary
{
    return [self
            cameraSupportsMedia:(__bridge NSString *)kUTTypeImage sourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}


- (BOOL) cameraSupportsMedia:(NSString *)paramMediaType sourceType:(UIImagePickerControllerSourceType)paramSourceType
{
    __block BOOL result = NO;
    if ([paramMediaType length] == 0) {
        return NO;
    }
    NSArray *availableMediaTypes = [UIImagePickerController availableMediaTypesForSourceType:paramSourceType];
    [availableMediaTypes enumerateObjectsUsingBlock: ^(id obj, NSUInteger idx, BOOL *stop) {
        NSString *mediaType = (NSString *)obj;
        if ([mediaType isEqualToString:paramMediaType]){
            result = YES;
            *stop= YES;
        }
    }];
    return result;
}
#pragma mark 1 拍照
- (void)showPhotosFromCamera
{
    
    // 拍照
    if ([self isCameraAvailable] && [self doesCameraSupportTakingPhotos]) {
        UIImagePickerController *controller = [[UIImagePickerController alloc] init];
        controller.sourceType = UIImagePickerControllerSourceTypeCamera;
        if ([self isFrontCameraAvailable]) {
            controller.cameraDevice = UIImagePickerControllerCameraDeviceRear;
        }
        
        NSMutableArray *mediaTypes = [[NSMutableArray alloc] init];
        [mediaTypes addObject:(__bridge NSString *)kUTTypeImage];
        controller.mediaTypes = mediaTypes;
        controller.delegate = self;
        [self presentViewController:controller
                           animated:YES
                         completion:^(void){
                             NSLog(@"Picker View Controller is presented");
                         }];
    } else {
        [self alertWithTitle:@"无法访问相机" msg:@"在\"设置>隐私>相机>Vgo\"中点击启用."];
    }
}

#pragma mark - UIImagePickerControllerDelegate
#pragma mark 2 拍照
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    [self showThisImagePicker:picker info:info];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [picker dismissViewControllerAnimated:YES completion:^(){
    }];
}


#pragma mark 3 拍照
- (void)showThisImagePicker:(UIImagePickerController *)picker info:(NSDictionary *)info
{
    [picker dismissViewControllerAnimated:YES completion:^() {
        UIImage *portraitImg = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
        NSData* imageData = UIImageJPEGRepresentation(portraitImg, 0.1);
        
        if (imageData == NULL) {
            return;
        }
        
        NSString *base64EncodedString = [NSString base64StringFromData:imageData length:[imageData length]];
        NSString *encodedImageStr = base64EncodedString;
        NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
        [dict setObject:encodedImageStr forKey:@"signedUrl"];
        [dict setObject:@".png" forKey:@"headType"];
//        [_imageList addObject:dict];
        for (int i = 0; i < _picArray.count; i++) {
            NSMutableDictionary *jiaDict = [_picArray objectAtIndex:i];
            NSString *type = [jiaDict objectForKey:@"type"];
            if ([type isEqualToString:@"type"]) {
                [_picArray removeObjectAtIndex:i];
            }
        }

        NSMutableDictionary *dictIm = [[NSMutableDictionary alloc] init];
//        VGReturnGoodsPicDTO *v = [[VGReturnGoodsPicDTO alloc] init];
//        v.picImage = portraitImg;
        [dictIm setObject:portraitImg forKey:@"image"];
        [dictIm setObject:@"1" forKey:@"type"];
        [_picArray addObject:dictIm];
        
        NSMutableDictionary *jDict = [[NSMutableDictionary alloc] init];
        [jDict setObject:@"image" forKey:@"image"];
        [jDict setObject:@"type" forKey:@"type"];
        [_picArray addObject:jDict];
        [_tableView reloadData];
    }];
}

#pragma mark 照片
- (void)showSelectPhotos
{
    if (![self isPhotoLibraryAvailable]) {
        [self alertWithTitle:@"无法访问相机" msg:@"在\"设置>隐私>照片>Vgo\"中点击启用."];
        return;
    }
    QBImagePickerController *imagePickerController = [QBImagePickerController new];
    imagePickerController.delegate = self;
    imagePickerController.allowsMultipleSelection = YES;
    imagePickerController.showsNumberOfSelectedAssets = YES;
    //    imagePickerController.maximumNumberOfSelection = 5;
    
    [self presentViewController:imagePickerController animated:YES completion:NULL];
}


#pragma mark - QBImagePickerControllerDelegate

- (void)qb_imagePickerController:(QBImagePickerController *)imagePickerController didSelectAssets:(NSArray *)assets
{
    NSLog(@"Selected assets:");
    NSLog(@"%@", assets);// addbtn100
    for (ALAsset *result in assets) {
        // ALAsset的类型
        NSString *assetType = [result valueForProperty:ALAssetPropertyType];
        if ([assetType isEqualToString:ALAssetTypePhoto]){
            ALAssetRepresentation *assetRepresentation =[result defaultRepresentation];
            //            CGFloat imageScale = [assetRepresentation scale];
            UIImageOrientation imageOrientation = (UIImageOrientation)[assetRepresentation orientation];
            
            CGImageRef imageReference = [assetRepresentation fullResolutionImage];
            // 对找到的图片进行操作
            UIImage *image = [[UIImage alloc] initWithCGImage:imageReference scale:1.0 orientation:imageOrientation];
            if (image != nil){
                
                for (int i = 0; i < _picArray.count; i++) {
                    NSMutableDictionary *jiaDict = [_picArray objectAtIndex:i];
                    NSString *type = [jiaDict objectForKey:@"type"];
                    if ([type isEqualToString:@"type"]) {
                        [_picArray removeObjectAtIndex:i];
                    }
                }
                
                VGReturnGoodsPicDTO *v = [[VGReturnGoodsPicDTO alloc] init];
                v.picImage = image;
                v.asset = result;
                NSMutableDictionary *dictIm = [[NSMutableDictionary alloc] init];
                [dictIm setObject:image forKey:@"image"];
                [dictIm setObject:@"1" forKey:@"type"];
                [_picArray addObject:dictIm];
                
                NSMutableDictionary *jDict = [[NSMutableDictionary alloc] init];
                [jDict setObject:@"image" forKey:@"image"];
                [jDict setObject:@"type" forKey:@"type"];
                [_picArray addObject:jDict];
                
                [_tableView reloadData];
            } else {
                NSLog(@"Failed to create the image.");
            }
        }
    }
    
    [self dismissViewControllerAnimated:YES completion:NULL];
//    [self cat];
}

- (void)qb_imagePickerControllerDidCancel:(QBImagePickerController *)imagePickerController
{
    [self dismissViewControllerAnimated:YES completion:NULL];
}


- (void)cat {
    NSMutableArray *strarr = nil;
    
    for (int i=0; i<_picArray.count; i++) {
        if (!strarr) {
            strarr = [NSMutableArray array];
        }
        VGReturnGoodsPicDTO *dto = [_picArray objectAtIndex:i];
        NSString *base64 = [self postImage:dto.picImage];
        NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
        [dict setObject:base64 forKey:@"signedUrl"];
        [dict setObject:@".png" forKey:@"headType"];
        [_imageList addObject:dict];
    }
    
    NSLog(@"wwwwwwwwwwwwww %@",_imageList);
}

- (NSString *)postImage:(UIImage *)portraitImg
{
    //    portraitImg = [portraitImg imageByScalingAndCroppingForSize:CGSizeMake(60, 60)];
    
    NSData* imageData = UIImageJPEGRepresentation(portraitImg, 0.1);
    
    if (imageData == NULL) {
        return nil;
    }
    
    NSString *base64EncodedString = [NSString base64StringFromData:imageData length:[imageData length]];
    
    NSString *encodedImageStr = base64EncodedString;
    
    return encodedImageStr;
}



@end
